import maya.cmds as cmds
import random
import math
def magnitude (v):
x= v[0]
y= v[1]
z= v[2]
m = math.sqrt ((x*x)+(y*y)+(z*z))
return m
def distance (p1, p2):
#substract both vectors
x1 = p1[0]
y1 = p1[1]
z1 = p1[2]
x2 = p2[0]
y2 = p2[1]
z2 = p2[2]
x = x1-x2
y = y1-y2
z = z1-z2
m = magnitude ([x,y,z])
return m
def unit(v):
#returns unit vector of v
#first get magnitude
m = magnitude(v)
x = v[0]
y = v[1]
z = v[2]
#devide each element by magnitude
x = x/m
y = y/m
z = z/m
vu = [x,y,z]
return vu
def move (v, amount):
"Move by certaine amount in directio v"
x = v[0]
y = v[1]
z = v[2]
x = x+amount
y = y+amount
z = z+amount
newP = [x,y,z]
return amount
def vectorBetweenPoints (p1, p2):
"Returns vector between p1 and p2"
#substract both vectors
x1 = p1[0]
y1 = p1[1]
z1 = p1[2]
x2 = p2[0]
y2 = p2[1]
z2 = p2[2]
x = x1-x2
y = y1-y2
z = z1-z2
newV = [x,y,z]
return newV
def moveVert (allCvs):
selLoc = cmds.filterExpand (sm = 22)
xs = 0
ys = 0
zs = 0
for i in allCvs:
pos = cmds.pointPosition(i)
posLoc = cmds.pointPosition (selLoc)
dd = distance ([centerX, centerY, centerZ], posLoc)
print dd
cmds.polyExtrudeVertex( l =dd, w=3, d=4 )
def moveVertice (allCvs):
selLoc = cmds.filterExpand (sm = 22)
allCvs1 = cmds.ls("nurbsPlane2.cv[:][:]", fl=1)
#d=1000
dist =1000
allDist =[]
print selLoc
for i in allCvs1:
pos = cmds.pointPosition(i)
for j in selLoc:
posLoc = cmds.pointPosition (j)
dd = distance (pos, posLoc)
if dd
Sunday, July 12, 2009
Masha - Assignment 03B
Subscribe to:
Post Comments (Atom)
Sorry it's assignment 03B
ReplyDelete