SkinningTools.Maya.tools.mathUtils
¶
Module Contents¶
Functions¶
|
|
|
Get the closest point on a line. The line is defined by the provided a |
|
convert list of 16 floats to an OpenMaya MMatrix |
|
get the center position from all input positions |
|
function to get current scene up axis |
|
Get the tweening method from a string, if the function doesn’t exists |
Get all of the available tweening methods. |
|
|
get the vectors of which the matrix is made (index 3 will give the position) |
|
Perform a laplacian smoothing on the provided vectors based on a |
|
convert a minimal of 2 positions to an aim matrix |
|
convert MMatrix to a list of 16 floats |
|
get the length bewtween 2 given objects translations |
|
Get the parameter of a point on a line. For this function to give a |
|
set the positon of a given OpenMaya MMatrix by a vector/ float list |
|
Sort the provided nodes list based on the distance between the point and |
|
convert a list or tuple to an MPoint |
|
convert a list or tuple to an MVector |
|
convenience function convert a list of floatlists or intlists to a list of MVectors |
|
convert list of OpenMaya MVector to an OpenMaya MMatrix |
-
SkinningTools.Maya.tools.mathUtils.
clamp
(value, minValue, maxValue)¶
-
SkinningTools.Maya.tools.mathUtils.
closestPointOnLine
(a, b, point)¶ Get the closest point on a line. The line is defined by the provided a and b point. The point is the point in space that is used to find the closest point on the line.
- Parameters
a (MVector) – point a of the line
b (MVector) – point b of the line
point (MVector) – the point gather the information from
- Returns
Closest point on line
- Return type
MVector
-
SkinningTools.Maya.tools.mathUtils.
easeInOutCircular
(n)¶
-
SkinningTools.Maya.tools.mathUtils.
easeInOutCubic
(n)¶
-
SkinningTools.Maya.tools.mathUtils.
easeInOutExponential
(n)¶
-
SkinningTools.Maya.tools.mathUtils.
easeInOutQuadratic
(n)¶
-
SkinningTools.Maya.tools.mathUtils.
easeInOutQuartic
(n)¶
-
SkinningTools.Maya.tools.mathUtils.
easeInOutQuintic
(n)¶
-
SkinningTools.Maya.tools.mathUtils.
easeInOutSinusoidal
(n)¶
-
SkinningTools.Maya.tools.mathUtils.
floatToMatrix
(floatList)¶ convert list of 16 floats to an OpenMaya MMatrix
- Parameters
floatList (list) – list of at least 16 floats/ints to convert to a matrix
- Returns
the OpenMaya MMatrix to be used in matrix calculations
- Return type
MMatrix
-
SkinningTools.Maya.tools.mathUtils.
getCenterPosition
(inPositions)¶ get the center position from all input positions
- Parameters
inPositions (list) – list of vectors that represent a cluster of positions
- Returns
center position of current given positions
- Return type
MVector
-
SkinningTools.Maya.tools.mathUtils.
getSceneUp
(asIndex=True)¶ function to get current scene up axis
- Parameters
asIndex (bool) – if True will return the index of current upvector, if False will return string representation
- Returns
scene up axis
- Return type
int,string
-
SkinningTools.Maya.tools.mathUtils.
getTweeningMethod
(method)¶ Get the tweening method from a string, if the function doesn’t exists None will be returned.
- Returns
Tweening function
- Return type
func/None
-
SkinningTools.Maya.tools.mathUtils.
getTweeningMethods
()¶ Get all of the available tweening methods.
- Returns
Tweening methods
- Return type
dict
-
SkinningTools.Maya.tools.mathUtils.
getVectorFromMatrix
(matrix, index)¶ get the vectors of which the matrix is made (index 3 will give the position)
- Parameters
matrix (MMatrix) – the matrix to translate
index (int) – index of row to grab information from
- Returns
the MVector that represents the row of given index from the matrix
- Return type
MVector
-
SkinningTools.Maya.tools.mathUtils.
laplacianSmoothing
(vectors, connected, iterations=3)¶ Perform a laplacian smoothing on the provided vectors based on a connection mapper. The position of the new vector is set based on the index of that vector and its connected vectors based on the connected indices. The new vector position is the average position of the connected vectors.
- Parameters
vectors (list) –
connected (dict) –
iterations (int) –
- Returns
Smoothed vectors
- Return type
list
-
SkinningTools.Maya.tools.mathUtils.
lookAt
(base, aim, up=None, primaryAxis=toVec3(1, 0, 0), secondaryAxis=toVec3(0, 1, 0), invertTerz=False)¶ convert a minimal of 2 positions to an aim matrix
- Parameters
Base (MVector) – base position of the mmatrix
aim (MVector) – position the matrix needs to point towards
up (MVector) – poition that the matrix needs to identify the secondary lookat
primaryAxis (MVector) – vector used as the aim for current matrix
secondaryAxis (MVector) – vector used as the up axis
- Returns
the matrix created from 2 vectors
- Return type
MMatrix
-
SkinningTools.Maya.tools.mathUtils.
matrixToFloatList
(matrix)¶ convert MMatrix to a list of 16 floats
- Parameters
matrix (MMAtrix) – OpenMaya MMatrix to convert
- Returns
list of 16 floats gathered from a matrix
- Return type
list
-
SkinningTools.Maya.tools.mathUtils.
measureLength
(object1, object2)¶ get the length bewtween 2 given objects translations
- Parameters
object1 (string) – 1st object to get transformation data from
object2 (string) – 2nd object to get transformation data from
- Returns
length between 2 given objects
- Return type
float
-
SkinningTools.Maya.tools.mathUtils.
parameterOfPointOnLine
(a, b, point)¶ Get the parameter of a point on a line. For this function to give a correct result it is important that the provided point already lies on the line. The
closestPointOnLine()
can be used to get that point on the line.- Parameters
a (MVector) – point a on the line
b (MVector) – point b on the line
point (MVector) – the position in space to check the parameter on the line
- Returns
Parameter of the point on the line
- Return type
float
-
SkinningTools.Maya.tools.mathUtils.
setMatPos
(matrix, vector)¶ set the positon of a given OpenMaya MMatrix by a vector/ float list
- Parameters
matrix (MMatrix) – the matrix to translate
vector (MVector) – the vector position to give the matrix
- Returns
the OpenMaya MMatrix to be used in matrix calculations
- Return type
MMatrix
-
SkinningTools.Maya.tools.mathUtils.
sortByDistance
(nodes, point, points)¶ Sort the provided nodes list based on the distance between the point and the points. With the nodes sorted from shortest distance to longest. It is expected that the order of the nodes link with the order of the points.
- Parameters
nodes (list) –
point (MVector) –
points (list) –
- Returns
Sorted node list and sorted points list
- Return type
tuple(list, list)
-
SkinningTools.Maya.tools.mathUtils.
toPoint
(inObject)¶ convert a list or tuple to an MPoint
- Parameters
inObject (list) – list of floats or ints
- Returns
point created from list
- Return type
MPoint
-
SkinningTools.Maya.tools.mathUtils.
toVec3
(inObject)¶ convert a list or tuple to an MVector
- Parameters
inObject (list) – list of floats or ints
- Returns
vector created from list
- Return type
MVector
-
SkinningTools.Maya.tools.mathUtils.
toVec3List
(inList)¶ convenience function convert a list of floatlists or intlists to a list of MVectors
- Parameters
inList (list) – list of lists
- Returns
list of MVectors
- Return type
list
-
SkinningTools.Maya.tools.mathUtils.
vectorsToMatrix
(vectorList)¶ convert list of OpenMaya MVector to an OpenMaya MMatrix
- Parameters
vectorList (list) – list of at least 3 MVectors (to make sure the rotation matrix is set)
- Returns
the OpenMaya MMatrix to be used in matrix calculations
- Return type
MMatrix