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 › Arrange objects on a circle
Page Index Toggle Pages: 1
Arrange objects on a circle (Read 536 times)
Arrange objects on a circle
Dec 3rd, 2007, 9:08pm
 
Hello!

I have 5 objects, painted in a for loop. Now i want them to arrange on a big cicle, like 300 x 300 px. Anyone can help me out with some piece of code?

Greets!
Re: Arrange objects on a circle
Reply #1 - Dec 3rd, 2007, 9:37pm
 
Code:
for(int i=0;i<5;i++)
{
float posx=150*sin(TWO_PI/5.0*i);
float posy=150*cos(TWO_PI/5.0*i);
//draw object number i
}


That will put the objects in a circle radius 150 around the point 0,0
Re: Arrange objects on a circle
Reply #2 - Dec 3rd, 2007, 9:50pm
 
Thanks alot for your help, everything works fine!
Page Index Toggle Pages: 1