rotate method
Contents
[
Hide
]rotate
Create a rotation matrix from a quaternion
Returns
def rotate(self, q):
...
Parameter | Type | Description |
---|---|---|
q | Quaternion | Rotation 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):
...
Parameter | Type | Description |
---|---|---|
angle | float | Rotate angle in radian |
axis | Vector3 | Rotation 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
- module
aspose.threed.utilities
- class
Matrix4