Sunday, May 24, 2009

Assignment 01B

import maya.cmds as cmds

#Step1:Define the biggest and smallest circles
BigRadius=30
SmallRadius=2
Minus= BigRadius-SmallRadius

#Step2:Create these two circles
cmds.circle(c=(0,0,0),r=30)
cmds.circle(c=(0,-28,0),r=2)

#Step3:Generate two circles which follow the tangent princples
#1)r1+r2=D
NextRadius=SmallRadius+1
D= NextRadius+SmallRadius
cmds.circle(c=(0,-28,0),r=D)

#2)offset the outmost circle based on the radius of next circle
cmds.circle(c=(0,0,0), r=BigRadius-NextRadius)
#3)Get the intersection point at the right side and as the center point of the new circle
# which is tangent with previous two circles
#Question:
# How to find out the coordinate of the intersection point in this case??????????????????????

'''
#Loop through it based on previous steps
for i in range(2,BigRadius,1):
cmds.circle(c=(0,0,0),r=Minus-i)
radius=3
r1= radius
r2= radius+i
radius+=1
D=r1+r2
cmds.circle(c=(the center coordinate from the intersection point),r=D)
'''

1 comment:

  1. Hi Liu,

    Did you get any results so far? You should always start part by part. First get the whole part before you reach your problem. Then you have to analyze what you have to see if out of that you can get the solution. Two curves can intersect in Maya via the curveIntersect command, and through it you can get several information about the intersection point, including the coordinates, of course.

    Also, the tangent calculation has to be done all by Math. Maya does not have a tangent command or something like it. Another option would be to do a stochastic search and get an approximation, but also for that you need to define more rules.

    Do like this: keep trying, get this script half working and post the results again. The logic seems clear, but your code is now a bit confusing and it is not really a script, so better get it running and then see where you really get stuck, right?

    ReplyDelete