Hey all.

I have a simple script that distributes spheres in a circular pattern
(fixed by Justin Israel), and was looking for a solution that would
distribute them in an ellipse/oval pattern. I am also trying to do this in
bifrost, but as I have done for the circular pattern I need to understand
the math first in python.

I also found this formula “(x2/a2) + (y2/b2) = 1” but not sure how to apply
it.

Thank you!

import maya.cmds as cmds

degrees = 180
max_iterations = 21
t_x = 6
radius=0.15

for i in range(max_iterations):

    print(i)


    if degrees % 360 == 0:
        rotation = float(degrees) / max_iterations * i
    else:
        rotation = float(degrees) * i / (max_iterations-1)

    my_sphere = cmds.polySphere(r=radius)
    cmds.move(t_x,my_sphere, x=1 , absolute=1)
    cmds.move( 0,0,0, [ my_sphere[0]+'.scalePivot',
my_sphere[0]+'.rotatePivot' ], xyz=1, absolute=1 )

    cmds.rotate(rotation, my_sphere, y=1)

-- 
You received this message because you are subscribed to the Google Groups 
"Python Programming for Autodesk Maya" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/python_inside_maya/CAEuwZHykcUm1Oc%2BQc%2BdU3BBt4rzP8wvLwvv3ckx2C%3DWo4CVHkg%40mail.gmail.com.

Reply via email to