Rotation in loops

If you're having trouble using Context Free or don't understand the language, ask for help here.

Moderators: MtnViewJohn, chris, mtnviewmark

Post Reply
User avatar
Lief
Posts: 2
Joined: Mon Jan 30, 2012 12:15 pm

Rotation in loops

Post by Lief »

startshape Test
shape Test{
// Line 1 ----------
dot[ y 6 h 150 sat 0.80 b 1.0000 ]
dot[ y 6 x 0.75 z -1 h 200 sat 1.60 b 1.0000 r -60 ]
dot[ y 6 x 1.5 z -2 h 250 sat 2.40 b 1.0000 r -120 ]
dot[ y 6 x 2.25 z -3 h 300 sat 3.20 b 1.0000 r -180 ]
// Line 2 ----------
loop 4[ x 0.75 z -1 h 50 sat 0.80 b 1.0000 ]{
dot[ y 4 h 150 sat 0.80 b 1.0000 ]
}
}
shape dot {
CIRCLE[ ]
CIRCLE[ y .5 s 0.5 ]
}
// Trying to get Line 2 to rotate as in Line 1 is this possible?

Pulni
Posts: 2
Joined: Thu Dec 01, 2011 1:58 pm

Re: Rotation in loops

Post by Pulni »

Won't "loop 4[ x 0.75 z -1 h 50 sat 0.80 b 1.0000 r -60 ]" do the trick?

User avatar
MtnViewJohn
Site Admin
Posts: 882
Joined: Fri May 06, 2005 2:26 pm
Location: Mountain View, California
Contact:

Re: Rotation in loops

Post by MtnViewJohn »

No, the rotation cannot be done in the loop transform, it must be done in the loop body.

Code: Select all

  loop i=4 [x 0.75 sat 0.8 z -1 h 50]
    dot [y 6 b 1 h 150 sat 0.8 r (i * -60)] 

User avatar
Lief
Posts: 2
Joined: Mon Jan 30, 2012 12:15 pm

Re: Rotation in loops

Post by Lief »

Thanks MtnViewJohn
Never thought of doing it that way.
Lief

Post Reply