mgear.core.vector module
Functions to work with vectors
- class mgear.core.vector.Blade(t=pymel.core.datatypes.Matrix)
Bases:
object
The Blade object for shifter guides
- mgear.core.vector.calculatePoleVector(p1, p2, p3, poleDistance=1, time=1)
This function takes 3 PyMEL PyNodes as inputs. Creates a pole vector position at a “nice” distance away from a triangle of positions. Normalizes the bone lengths relative to the knee to calculate straight ahead without shifting up and down if the bone lengths are different. Returns a pymel.core.datatypes.Vector
- Parameters:
p1 (dagNode) – Object A
p2 (dagNode) – Object B
p3 (dagNode) – Object C
poleDistance (float) – distance of the pole vector from the mid point
- Returns:
The transposed vector.
- Return type:
vector
- mgear.core.vector.getDistance(v0, v1)
Get the distance between 2 vectors
- Parameters:
v0 (vector) – vector A.
v1 (vector) – vector B.
- Returns:
Distance length.
- Return type:
float
- mgear.core.vector.getDistance2(obj0, obj1)
Get the distance between 2 objects.
- Parameters:
obj0 (dagNode) – Object A
obj1 (dagNode) – Object B
- Returns:
Distance length
- Return type:
float
- mgear.core.vector.getPlaneBiNormal(v0, v1, v2)
Get the binormal vector of a plane (Defined by 3 positions).
- Parameters:
v0 (vector) – First position on the plane.
v1 (vector) – Second position on the plane.
v2 (vector) – Third position on the plane.
- Returns:
The binormal.
- Return type:
vector
- mgear.core.vector.getPlaneNormal(v0, v1, v2)
Get the normal vector of a plane (Defined by 3 positions).
- Parameters:
v0 (vector) – First position on the plane.
v1 (vector) – Second position on the plane.
v2 (vector) – Third position on the plane.
- Returns:
The normal.
- Return type:
vector
- mgear.core.vector.getTransposedVector(v, position0, position1, inverse=False)
Get the transposed vector.
- Parameters:
v (vector) – Input Vector.
position0 (vector) – Position A.
position1 (vector) – Position B.
inverse (bool) – Invert the rotation.
- Returns:
The transposed vector.
- Return type:
vector
>>> normal = vec.getTransposedVector(self.normal, [self.guide.apos[0], self.guide.apos[1]], [self.guide.apos[-2], self.guide.apos[-1]])
- mgear.core.vector.linearlyInterpolate(v0, v1, blend=0.5)
Get the vector interpolated between 2 vectors.
- Parameters:
v0 (vector) – vector A.
v1 (vector) – vector B.
blend (float) – Blending value.
- Returns:
The interpolated vector.
- Return type:
vector
- mgear.core.vector.rotateAlongAxis(v, axis, a)
Rotate a vector around a given axis defined by other vector.
- Parameters:
v (vector) – The vector to rotate.
axis (vector) – The axis to rotate around.
a (float) – The rotation angle in radians.