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 › rotating in its own center
Page Index Toggle Pages: 1
rotating in its own center (Read 842 times)
rotating in its own center
Jun 23rd, 2009, 11:20am
 
hello, i need to rotata a line in its own center without using the rotate methods.
Im trying the following code, but i just can rotate the line around one of the points of the line.
Is there any trick for making the line to rotate in its own center?



many thanks

seb.


Code:

float x;
float y;
float aumenta;

void setup()
{
size(500, 500);
background(250, 250, 250);
}


void draw()
{

background(250, 250, 250);
aumenta = aumenta + 0.01;
x = 60 * cos(aumenta) + 177;
y = 60 * sin(aumenta) + 177;
line(x, y, 177, 177 );
}


Re: rotating in its own center
Reply #1 - Jun 23rd, 2009, 11:37am
 
if you want 177,177 to be the center of the line then try to
modify your draw methode like this

void draw()
{
 
 background(250, 250, 250);
 aumenta = aumenta + 0.01;
 x = 60 * cos(aumenta);
 y = 60 * sin(aumenta);
 line( 177 +x, 177+ y, 177-x, 177-y );
 }
Page Index Toggle Pages: 1