Page 1 of 1

Puzzled by effect of negative size adjustment

Posted: Tue Jan 22, 2013 7:02 pm
by GeorgeFreeman
By accident, I put a negative size adjustment into a randomized recursion:

startshape SPIRAL

shape SPIRAL
rule { CIRCLE [] SPIRAL [x 1 r 0.5 s 0.99999] }
rule { CIRCLE [] SPIRAL [x 1 r 0.5 s -0.99999] }

I cannot figure out why C-F is generating the visual result I am getting.
Can anyone explain this to me?

The result is here: http://www.contextfreeart.org/gallery/view.php?id=3163

Thanks in advance,

GF

Re: Puzzled by effect of negative size adjustment

Posted: Tue Jan 22, 2013 11:04 pm
by MtnViewJohn
Scaling by a negative number inverts the affine transform. When the affine transform is inverted the x 1 becomes x -1 and the r 0.5 becomes r -0.5. The next time you scale by a negative number the affine transforms inverts again and x 1 is x 1 and r 0.5 is r 0.5.

Re: Puzzled by effect of negative size adjustment

Posted: Wed Jan 23, 2013 6:21 am
by kipling
... another way of viewing it is that s -1 is precisely the same as r 180, so s -0.999 is the same as s 0.999 r 180.

Geometrically, in 2 dimensions, reflection in a point (such as the origin) is the same as a 180 degree rotation.

FWIW, I'll correct what MtnViewJohn wrote: after the transformation, r 0.5 stays as r 0.5

Re: Puzzled by effect of negative size adjustment

Posted: Wed Jan 23, 2013 10:38 am
by GeorgeFreeman
Thanks to kipling and MVJ for your prompt replies.
If I rewrite the second randomization rule as
rule { CIRCLE [] SPIRAL [x 1 r 180.5 s 0.99999] }

I get a visual result that is very similar to
rule { CIRCLE [] SPIRAL [x 1 r 0.5 s -0.99999] }

but it is not identical (using the same variation seed). So kipling's answer seems very close to observation, but does not conform exactly. Apologies if I am being thick here, but I guess what I am asking is: what would be the equivalent to my grammar using a positive scale, or if such a thing is not possible to create, why? Or is the issue that the grammars are not randomizing the same way, even using the same seed?

Again, thanks in advance for taking the time to explain things to a newbie.

G

Re: Puzzled by effect of negative size adjustment

Posted: Thu Jan 24, 2013 8:48 am
by MtnViewJohn
That's right. Mixing positive and negative size like s 0.99999 -0.99999 inverts the transform, but a simple negative size like s -0.99999 is just a 180° rotation. I got the two confused.

If you replace the second SPIRAL rule with

Code: Select all

rule { SPIRAL [r 180] }
you get the same result.