<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<body text="#000000" bgcolor="#FFFFFF">
<div class="moz-cite-prefix">Le 03/03/2024 à 12:39, Hilaire
Fernandes a écrit :<br>
</div>
<blockquote type="cite"
cite="mid:2bff21c4-7fcc-451d-81c0-aca3354071a9@free.fr">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.</blockquote>
<p>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:</p>
<p><!-- HTML generated using hilite.me --></p>
<div
style="background: #ffffff; overflow:auto;width:auto;border:solid gray;border-width:.1em .1em .1em .8em;padding:.2em .6em;">
<pre style="margin: 0; line-height: 125%"><span
style="color: #333333">|</span><span style="color: #996633"> rect1 rect2 transformation v </span><span
style="color: #333333">|</span>
<span style="color: #996633">v</span> <span style="color: #333333">:=</span> <span
style="color: #6600EE; font-weight: bold">60</span><span
style="color: #0066BB; font-weight: bold">@</span><span
style="color: #6600EE; font-weight: bold">20</span>.
<span style="color: #996633">rect1</span> <span style="color: #333333">:=</span> <span
style="color: #BB0066; font-weight: bold">Rectangle1Morph</span> <span
style="color: #007020">new</span> <span
style="color: #0066BB; font-weight: bold">openInWorld</span>.
<span style="color: #996633">rect2</span> <span style="color: #333333">:=</span> <span
style="color: #BB0066; font-weight: bold">Rectangle2Morph</span> <span
style="color: #007020">new</span> <span
style="color: #0066BB; font-weight: bold">openInWorld</span>.
<span style="color: #996633">rect1</span> <span
style="color: #0066BB; font-weight: bold">morphPosition:</span> <span
style="color: #BB0066; font-weight: bold">DisplayScreen</span> <span
style="color: #0066BB; font-weight: bold">actualScreenSize</span> <span
style="color: #0066BB; font-weight: bold">//</span> <span
style="color: #6600EE; font-weight: bold">2</span> <span
style="color: #0066BB; font-weight: bold">-</span> v.
<span style="color: #996633">rect2</span> <span
style="color: #0066BB; font-weight: bold">morphPosition:</span> <span
style="color: #BB0066; font-weight: bold">DisplayScreen</span> <span
style="color: #0066BB; font-weight: bold">actualScreenSize</span> <span
style="color: #0066BB; font-weight: bold">//</span> <span
style="color: #6600EE; font-weight: bold">2</span>.
<span style="color: #996633">transformation</span> <span
style="color: #333333">:=</span> <span style="color: #996633">rect1</span> <span
style="color: #0066BB; font-weight: bold">location</span> <span
style="color: #0066BB; font-weight: bold">composedWith:</span> (
(<span style="color: #BB0066; font-weight: bold">AffineTransformation</span> <span
style="color: #0066BB; font-weight: bold">withTranslation:</span> <span
style="color: #996633">v</span>) <span
style="color: #0066BB; font-weight: bold">composedWith:</span>
((<span style="color: #BB0066; font-weight: bold">AffineTransformation</span> <span
style="color: #0066BB; font-weight: bold">withScale:</span> <span
style="color: #6600EE; font-weight: bold">2</span>) <span
style="color: #0066BB; font-weight: bold">composedWith:</span>
(<span style="color: #BB0066; font-weight: bold">AffineTransformation</span> <span
style="color: #0066BB; font-weight: bold">withTranslation:</span> <span
style="color: #996633">v</span> <span
style="color: #0066BB; font-weight: bold">negated</span>)) ).
<span style="color: #996633">rect1</span> <span
style="color: #0066BB; font-weight: bold">location:</span> <span
style="color: #996633">transformation</span>.
<span style="color: #996633">rect2</span> <span
style="color: #0066BB; font-weight: bold">scaleBy:</span> <span
style="color: #6600EE; font-weight: bold">2</span>.
<span style="color: #888888">"</span>
<span style="color: #888888">Rectangle1Morph allInstancesDo: [:each | each delete].</span>
<span style="color: #888888">Rectangle2Morph allInstancesDo: [:each | each delete].</span>
<span style="color: #888888">"</span>
</pre>
</div>
<p>Observe the scaled blue and pink rectangles are at now at the
same position.</p>
<p>Hilaire<br>
</p>
<pre class="moz-signature" cols="72">--
GNU Dr. Geo
<a class="moz-txt-link-freetext" href="http://gnu.org/s/dr-geo/">http://gnu.org/s/dr-geo/</a>
<a class="moz-txt-link-freetext" href="http://gnu-drgeo.blogspot.com/">http://gnu-drgeo.blogspot.com/</a></pre>
</body>
</html>