Construct a 4x4 rotation matrix from Euler angles.
Rotations are combined by first rotating about the X axis, then Y, and finally Z.
rx (float) – Rotation angles (pitch, yaw, and roll).
ry (float) – Rotation angles (pitch, yaw, and roll).
rz (float) – Rotation angles (pitch, yaw, and roll).
degrees (bool, optional) – Rotation angles are specified in degrees. If False, they will be assumed as radians. Default is True.
out (ndarray, optional) – Optional output array. Must be same shape and dtype as the expected output if out was not specified.
dtype (dtype or str, optional) – Data type for computations can either be ‘float32’ or ‘float64’. If out is specified, the data type of out is used and this argument is ignored. If out is not provided, ‘float64’ is used by default.
4x4 rotation matrix.
Demonstration of how a combination of axis-angle rotations is equivalent to a single call of matrixFromEulerAngles:
m1 = matrixFromEulerAngles(90., 45., 135.)) # construct rotation matrix from 3 orthogonal rotations rx = rotationMatrix(90., (1, 0, 0)) # x-axis ry = rotationMatrix(45., (0, 1, 0)) # y-axis rz = rotationMatrix(135., (0, 0, 1)) # z-axis m2 = concatenate([rz, ry, rx]) # note the order print(numpy.allclose(m1, m2)) # True
Not only does matrixFromEulerAngles require less code, it also is considerably more efficient than constructing and multiplying multiple matrices.