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
Puzzled by effect of negative size adjustment
Moderators: MtnViewJohn, chris, mtnviewmark
-
- Posts: 2
- Joined: Wed Jan 16, 2013 5:57 pm
- MtnViewJohn
- Site Admin
- Posts: 882
- Joined: Fri May 06, 2005 2:26 pm
- Location: Mountain View, California
- Contact:
Re: Puzzled by effect of negative size adjustment
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
... 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
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
-
- Posts: 2
- Joined: Wed Jan 16, 2013 5:57 pm
Re: Puzzled by effect of negative size adjustment
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
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
- MtnViewJohn
- Site Admin
- Posts: 882
- Joined: Fri May 06, 2005 2:26 pm
- Location: Mountain View, California
- Contact:
Re: Puzzled by effect of negative size adjustment
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
you get the same result.
If you replace the second SPIRAL rule with
Code: Select all
rule { SPIRAL [r 180] }