mathutils module¶
Vector, Quaternion and Matrix classes
Matrix3¶
-
class
modo.mathutils.
Matrix3
(other=None)[source]¶ Matrix3 class
-
__init__
(other=None)[source]¶ Initializes a Matrix object
Parameters: other (Matrix3) – Copies from other Matrix3 (optional) returns: Matrix3
-
__mul__
(other)[source]¶ Multiply with other matrix
Parameters: other (Matrix3) – Matrix to multiply with
-
__weakref__
¶ list of weak references to the object (if defined)
-
asEuler
(degrees=False, order='zxy')[source]¶ Returns euler values from the Matrix
Parameters: - degrees (bool) – If True, the values are returned as degrees, otherwise as radians
- order (basestring) – The rotation order to return values for.
Return list: Euler values
-
Matrix4¶
-
class
modo.mathutils.
Matrix4
(other=None, position=None)[source]¶ Bases:
modo.mathutils.Matrix3
Matrix class
-
__init__
(other=None, position=None)[source]¶ Initializes a Matrix object
Parameters: - other (Matrix4) – Copies from other Matrix4 (optional)
- position (iterable) – Translation value to set (optional)
returns: Matrix4
-
position
¶ Getter: Returns the translation part of this matrix Return type: tuple Setter: Sets the translation part of this matrix Parameters: position (iterable) – Position
-
Vector3¶
-
class
modo.mathutils.
Vector3
(*a)[source]¶ Vector3 class
-
__init__
(*a)[source]¶ Parameters: a (float) – Three float values Return Vector3: The initialized Vector3 object
-
__mul__
(other)[source]¶ Vector multiplication
Parameters: other – Can be another Vector3, a Matrix4 or a float value. When other is a Vector3 the result is a component-wise multiplication
-
__weakref__
¶ list of weak references to the object (if defined)
-
lerp
(other, t)[source]¶ Perform linear blending between this and other Vector3
Parameters: - other (Vector3) – Other vector
- t (float) – Parameter between 0.0 and 1.0
-
mulByMatrixAsPoint
(other)[source]¶ Transform this point’s position by a Matrix4 in place.
Parameters: other (Matrix4) – Other Matrix
-
rotateByAxisAngle
(axis, angle)[source]¶ Rotates this vector by a given axis and angle
Parameters: - axis (Vector3) – This axis to rotate about
- angle (float) – The angle in radians to rotate by
-
x
¶ Quick access to the x component of the vector
-
y
¶ Quick access to the y component of the vector
-
z
¶ Quick access to the z component of the vector
-
Quaternion¶
-
class
modo.mathutils.
Quaternion
(values=None)[source]¶ Minimal quaternion class
-
__weakref__
¶ list of weak references to the object (if defined)
-
fromMatrix3
(input)[source]¶ This function converts a matrix into a quaternion, containing the same rotation.
Parameters: - input (Matrix3) –
- output (Quaternion) –
-
fromMatrix4
(input)[source]¶ This function converts a matrix into a quaternion, containing the same rotation.
Parameters: input (Matrix4) –
-
getAxisAngle
()[source]¶ Returns the axis and angle of this quaternion
Returns tuple: Axis [tuple] and angle [float]
-
setAxisAngle
(axis, angle)[source]¶ This function takes an axis and an angle, and calculates a quaternion that encodes that rotation.
Parameters: - angle (float) – Angle in radians
- axis (Vector3) – Axis
-
toMatrix3
()[source]¶ This function converts a quaternion into a Matrix3, containing the same rotation.
Return Matrix3: Result
-
w
¶ Quick access to the w component of the quaternion
-
x
¶ Quick access to the x component of the quaternion
-
y
¶ Quick access to the y component of the quaternion
-
z
¶ Quick access to the z component of the quaternion
-