We closed this forum 18 June 2010. It has served us well since 2005 as the ALPHA forum did before it from 2002 to 2005. New discussions are ongoing at the new URL http://forum.processing.org. You'll need to sign up and get a new user account. We're sorry about that inconvenience, but we think it's better in the long run. The content on this forum will remain online.
Page Index Toggle Pages: 1
Stop rotation (Read 270 times)
Stop rotation
Nov 26th, 2008, 9:40pm
 
Hi,

I have two beziers, one after the other. I want to rotate the two of them but the first with an angel of 90, and the second with an angel of 120, how can I prevent that the second one mouves with an angel of 210? can I turn down a rotation??

Example:

rotate(radians(90);
bezier(px, py, px2, py2, px3, py3, px, py);

rotate(radians(120);
bezier(px, py, -px2, -py2, -px3, -py3, px, py);


This will make the second bezier turn with an angel of 210 because the two rotation are accumulated.
Thanks.

Re: Stop rotation
Reply #1 - Nov 26th, 2008, 9:54pm
 
Try:

pushMatrix();

rotate(radians(90);
bezier(px, py, px2, py2, px3, py3, px, py);

popMatrix();

rotate(radians(120);
bezier(px, py, -px2, -py2, -px3, -py3, px, py);



basically pushMatrix() will "store" the rotation, then popMatrix() "resets" that transformative process.  Note that this can be nested.
Re: Stop rotation
Reply #2 - Nov 26th, 2008, 10:03pm
 
Yeap, that's what I wanted. Thanks

Alex
Page Index Toggle Pages: 1