rotate method

rotate

Create a rotation matrix from a quaternion

Returns

def rotate(self, q):
    ...
ParameterTypeDescription
qQuaternionRotation quaternion

Example

The following code shows how to create a matrix for rotate operation.

from aspose.threed.utilities import Matrix4, Quaternion, Vector3
import math

t = Matrix4.rotate(Quaternion.from_angle_axis(math.pi, Vector3.Y_AXIS))
pos = Vector3(1, 1, 10)
print(f"Transformed: {t * pos}")

rotate

Create a rotation matrix by rotation angle and axis

Returns

def rotate(self, angle, axis):
    ...
ParameterTypeDescription
anglefloatRotate angle in radian
axisVector3Rotation axis

Example

The following code shows how to create a matrix for rotate operation.

from aspose.threed.utilities import Matrix4, Vector3
import math

t = Matrix4.rotate(math.pi, Vector3(0, 1, 0))
pos = Vector3(1, 1, 10)
print(f"Transformed: {t * pos}")

See Also