This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#F. Hiba, C. Mendes, B. Lefebvre, P. Hubert | |
import maya.api.OpenMaya as om | |
import maya.cmds as cmds | |
from math import radians, degrees, sin, cos | |
from random import gauss, random, uniform, shuffle | |
from copy import copy | |
#4 utilities function related to transformations | |
#give the quaternion corresponding to the rottion from vector 1 to vector 2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import maya.api.OpenMaya as om | |
import maya.cmds as cmds | |
#Returns normal, tangent, at a given point on a curve, given the curve and a position in space. | |
#result as a list of openmaya MVector() | |
def getCurveNormal(mayaCurve, pos=[0,0,0]): | |
selectionList = om.MSelectionList() | |
selectionList.add(mayaCurve) | |
dPath= selectionList.getDagPath(0) | |
mCurve=om.MFnNurbsCurve (dPath) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import maya.api.OpenMaya as om | |
import maya.cmds as cmds | |
#returns the closest vertex given a mesh and a position [x,y,z] in world space. | |
#Uses om.MfnMesh.getClosestPoint() returned face ID and iterates through face's vertices. | |
def getClosestVertex(mayaMesh,pos=[0,0,0]): | |
mVector = om.MVector(pos)#using MVector type to represent position | |
selectionList = om.MSelectionList() | |
selectionList.add(mayaMesh) | |
dPath= selectionList.getDagPath(0) |