[Cuis-dev] [ANN] Cuis-Smalltalk-RoadTrip idle game + a question on implementing a ZoomPanMorph

Ian Jeffries mail at ianjeffries.net
Fri Mar 8 12:08:53 PST 2024


We got it working with the translation-to-new-point strategy instead, but I
appreciate the help. I especially appreciate the tip to look into
homothety. My linear algebra is really weak, but it looks like a useful and
relatively easy-to-understand concept.

On Sun, Mar 3, 2024 at 7:15 AM Hilaire Fernandes via Cuis-dev <
cuis-dev at lists.cuis.st> wrote:

> Le 03/03/2024 à 12:39, Hilaire Fernandes a écrit :
>
> Affine transformations should be used and composed with translations and
> scale but I can't get a code snipped working yet. You could then extent
> your morph with the appropriate protocol.
>
> Here it is with the proper composed affine transformations to get the
> scaling with the center that suit you. The scaling is done around the point
> v:
>
> | rect1 rect2 transformation v |v := 60 at 20.rect1 := Rectangle1Morph new openInWorld.rect2 := Rectangle2Morph new openInWorld.rect1 morphPosition: DisplayScreen actualScreenSize // 2 - v.rect2 morphPosition: DisplayScreen actualScreenSize // 2.transformation := rect1 location composedWith: (
> 	(AffineTransformation withTranslation: v) composedWith: 		
> 		((AffineTransformation withScale: 2) composedWith: 	
> 			(AffineTransformation withTranslation: v negated)) ).	rect1 location: transformation.rect2 scaleBy: 2.
> "Rectangle1Morph allInstancesDo: [:each | each delete].Rectangle2Morph allInstancesDo: [:each | each delete]."
>
> Observe the scaled blue and pink rectangles are at now at the same
> position.
>
> Hilaire
>
> --
> GNU Dr. Geohttp://gnu.org/s/dr-geo/http://gnu-drgeo.blogspot.com/
>
> --
> Cuis-dev mailing list
> Cuis-dev at lists.cuis.st
> https://lists.cuis.st/mailman/listinfo/cuis-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.cuis.st/mailman/archives/cuis-dev/attachments/20240308/ec78076a/attachment.htm>


More information about the Cuis-dev mailing list