compose_matrix
- compas.geometry.compose_matrix(scale=None, shear=None, angles=None, translation=None, perspective=None)[source]
Calculates a matrix from the components of scale, shear, euler_angles, translation and perspective.
- Parameters
scale ([float, float, float]) – The 3 scale factors in x-, y-, and z-direction.
shear ([float, float, float]) – The 3 shear factors for x-y, x-z, and y-z axes.
angles ([float, float, float]) – The rotation specified through the 3 Euler angles about static x, y, z axes.
translation ([float, float, float]) – The 3 values of translation.
perspective ([float, float, float, float]) – The 4 perspective entries of the matrix.
- Returns
list[list[float]] – The 4x4 matrix that combines the provided transformation components.
Examples
>>> trans1 = [1, 2, 3] >>> angle1 = [-2.142, 1.141, -0.142] >>> scale1 = [0.123, 2, 0.5] >>> M = compose_matrix(scale1, None, angle1, trans1, None) >>> scale2, shear2, angle2, trans2, persp2 = decompose_matrix(M) >>> allclose(scale1, scale2) True >>> allclose(angle1, angle2) True >>> allclose(trans1, trans2) True