View Full Version : position objects on a circle
ehmdjii 12282004, 05:35 PM hello,
i want several objects positioned in a circle. i thought maxscript is the best way to do this, if not please tell me. ;)
now, what i try is the following:
r=20.0
p=3.1415
for i=1 to 16 do
(
mycyl = cylinder radius:6 height:20
mycyl.name = "cyl_"+ i as string
xx=sin(p*i/16.0)*r
yy=cos(p*i/16.0)*r
mycyl.pos = [xx,yy,0]
)
unfortunately this doesnt work and i cant figure out why?
thanks for any help.
edit: 2 minutes after i posted this, i figured it out.
sorry.
sin is calculated from 0 to 360 degrees and not from 0 to pi as in most languages.


hello,
i want several objects positioned in a circle. i thought maxscript is the best way to do this, if not please tell me. ;)
edit: 2 minutes after i posted this, i figured it out.
sorry.
sin is calculated from 0 to 360 degrees and not from 0 to pi as in most languages.
A couple of small notes:
In case you need Pi again some day, you can use it directly as it is already predefined as a System Global (sort of constant).
Also, in the function of the Circle, Cos is used to calculate the X and Sin is used for Y. You've got them the other way round...
ehmdjii
12282004, 11:02 PM
thank you, first of all.
A couple of small notes:
In case you need Pi again some day, you can use it directly as it is already predefined as a System Global (sort of constant).
ok, and how is it defined?
Also, in the function of the Circle, Cos is used to calculate the X and Sin is used for Y. You've got them the other way round...
i dont think that matters...
ok, and how is it defined?
As pi. http://www.rensheeren.com/images/cgtalk/dealF1.gif
galagast
12302004, 08:34 PM
this may be very embarassing, but i wud really want to understand how this works... im really eager to learn stuff like this... i guess i wasnt really paying much attention on this topic when i was in school... :sad:
sin(360*i/16.0)*r
or any of u guys can recommend a good book or site?
im looking at some stuff on the net right now, i was just hoping to hav more reference on this one... thanx in advance! :)
CGTalk Moderation
01202006, 07:00 AM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.