Rotation.from_euler_angles
- classmethod Rotation.from_euler_angles(euler_angles, static=True, axes='xyz', **kwargs)[source]
Construct a rotation transformation from Euler angles.
In 3D space any orientation can be achieved by composing three elemental rotations, rotations about the axes (x,y,z) of a coordinate system. A triple of Euler angles can be interpreted in 24 ways, which depends on if the rotations are applied to a static (extrinsic) or rotating (intrinsic) frame and the order of axes.
- Parameters:
- euler_angles: [float, float, float]
Three numbers that represent the angles of rotations about the defined axes.
- static: bool, optional
If True the rotations are applied to a static frame. If False, to a rotational.
- axes: str, optional
A 3 character string specifying order of the axes.
- Returns:
Examples
>>> from compas.geometry import allclose >>> ea1 = 1.4, 0.5, 2.3 >>> args = False, 'xyz' >>> R1 = Rotation.from_euler_angles(ea1, *args) >>> ea2 = R1.euler_angles(*args) >>> allclose(ea1, ea2) True
>>> alpha, beta, gamma = ea1 >>> xaxis, yaxis, zaxis = [1, 0, 0], [0, 1, 0], [0, 0, 1] >>> Rx = Rotation.from_axis_and_angle(xaxis, alpha) >>> Ry = Rotation.from_axis_and_angle(yaxis, beta) >>> Rz = Rotation.from_axis_and_angle(zaxis, gamma) >>> R2 = Rx * Ry * Rz >>> R1 == R2 True