Skip to main content

euler_rotation_matrix

Function euler_rotation_matrix 

Source
pub fn euler_rotation_matrix<T: Number>(angles_deg: Vector3<T>) -> Matrix3<T>
Expand description

Build a 3×3 rotation matrix from Euler angles (degrees), applied as Z × Y × X.

This is the extrinsic rotation convention matching OpenSCAD’s rotate([x, y, z]).

§Mathematical derivation

Given angles (α, β, γ) for (X, Y, Z) in radians:

Rx = ⎡ 1    0      0   ⎤    Ry = ⎡ cos β   0   sin β ⎤    Rz = ⎡ cos γ  -sin γ   0 ⎤
     ⎢ 0   cos α  -sin α⎥         ⎢  0      1    0    ⎥         ⎢ sin γ   cos γ   0 ⎥
     ⎣ 0   sin α   cos α⎦         ⎣-sin β   0   cos β ⎦         ⎣  0       0      1 ⎦

R = Rz · Ry · Rx