Using CurveMorph for build jigsaw puzzle

Lic. Edgar J. De Cleene edgardec2001 at
Wed Jan 25 09:35:13 UTC 2006

Peace Jerome puso en su mail :

> Hi Edgar,
> I took some time to think about your request. I would
> not use curves or curviers to build jigsaw puzzles.
> Your best bet is segmented polygons. You just need to
> add enough vertices to make a good curve
> approximation.
> Then arrange them in the solved puzzle. Give them a
> bitmapfill.
> Now for each piece do two things.
> Set the form of the fill to the picture of the entire
> solved puzzle and the origin of each bit fill to the
> same point (topLeft of the entire solved puzzle). Now
> each piece shows its portion of the puzzle. You can
> now scatter the pieces.
> Then of course you (or someone else) has a puzzle to
> solve.
> -----
> Why not curves.
> The way they are set up now each vertex adds something
> to determine how the curves are done. To get matching
> edges you would need something new that hasn't been
> invented yet in morphic. It's and interesting problem
> but I've relegated it to a back burner. It will
> require time and inspiration (which comes with time
> and chance).
> I thank you though for triggering some thought on the
> subject.
> Cheers and joy -- Jerome Peace

Very kind.

Actually, I have a Rompecabezas (puzzle) app, from my first incursions in

Is more Pascal what Smalltalk / Squeak and solves the problem with a
PuzzleMorph subclass of PolygonMorph what roughly do some similar to your

And was in for a long time now.

The made on it end in discovering the first bug on Squeak on 3.2 times, an
obscure case of when you do the fill some "pieces" don't could be grabbed .

What now I wish, as part of my students doing his first steps into Squeak
world, is give this awful code to one, and say what her should convert in a
semi - decent Squeak app.

And if is possible , use your beauty CurveMorph for doing.

I investigate about something like
| canvas |
    canvas _ FormCanvas extent: 40 at 32.
    canvas fillColor: (Color transparent).
    canvas drawPolygon: (Bezier3Segment example1) fillStyle: Color red
borderWidth: 2 borderColor: Color black.
    canvas form asMorph openInWorld

| canvas c|
    canvas _ FormCanvas extent: 40 at 32.
    canvas fillColor: (Color transparent).
    c _ Bezier3Segment new from: 16 at 32 via: 20 at 22 and: 22 at 22 to: 24 at 32.
    c _  c asBezierShape.
    canvas drawPolygon: c asPointArray fillStyle: Color red borderWidth: 1
borderColor: Color black.!

The problem could be solved merging a PolygonMorph and a Curve Morph, as in
attached picture (made by hand and quick for you have the idea).

I let for the wiz figure how to get a closed figure with straight and curve
segments  :=)

Very thanks !!!


-------------- next part --------------
A non-text attachment was scrubbed...
Name: Picture 1.png
Type: application/octet-stream
Size: 6723 bytes
Desc: not available
Url :

More information about the Squeak-dev mailing list