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.
IndexProgramming Questions & HelpSyntax Questions › Coordinate problems after using rotate().
Page Index Toggle Pages: 1
Coordinate problems after using rotate(). (Read 1196 times)
Coordinate problems after using rotate().
Nov 27th, 2009, 12:43pm
 
Hey guys. I am new to Processing so would appreciate any help.

I have three ellipses, constructed by:

translating to the center (width/2, height/2).
draw one ellipse.
rotate by some amount of degrees.
draw second ellipse.
rotate again.
draw final ellipse.

I am trying to connect the ellipses with lines to the center, but obviously the coordinates are completely different for the rotated ellipses.

This poses a problem when entering the x and y position of the lines, as i imagine the second and third ellipses are effectively on a new rotated grid. Or i may be completely wrong?

Is there a way around this?

Thanks a lot.
Re: Coordinate problems after using rotate().
Reply #1 - Nov 27th, 2009, 1:00pm
 
Since you change the model space after each call to rotate(), you may need these modelX() and modelY() methods to retrieve the position of your ellipses :
http://processing.org/reference/modelX_.html
Re: Coordinate problems after using rotate().
Reply #2 - Nov 27th, 2009, 1:22pm
 
wtf?! when did they introduce that command? thats new to me and i was really waiting for something like that. There should be a page where updates like this are listed so people can easily see what new features are added.
Re: Coordinate problems after using rotate().
Reply #3 - Nov 27th, 2009, 2:13pm
 
mmm... I guess it's been here since the beginning :-p

See
http://processing.org/reference/changes.html
and
revisions.txt which comes with every new version.
Re: Coordinate problems after using rotate().
Reply #4 - Nov 27th, 2009, 2:44pm
 
i always read the revisions.txt but i missed that. but you are right, it was there from the beginning but was called objectX instead of modelX.... good to know
Re: Coordinate problems after using rotate().
Reply #5 - Nov 27th, 2009, 6:06pm
 
Thanks a lot for your help. It's much appreciated!
Page Index Toggle Pages: 1