basis_vectors_from_matrix

compas.geometry.basis_vectors_from_matrix(R)[source]

Returns the basis vectors from the rotation matrix R.

Parameters

R (list[list[float]]) – A 4-by-4 transformation matrix, or a 3-by-3 rotation matrix.

Returns

  • [float, float, float] – The first basis vector of the rotation.

  • [float, float, float] – The second basis vector of the rotation.

Raises

ValueError – If rotation matrix is invalid.

Examples

>>> from compas.geometry import Frame
>>> f = Frame([0, 0, 0], [0.68, 0.68, 0.27], [-0.67, 0.73, -0.15])
>>> R = matrix_from_frame(f)
>>> xaxis, yaxis = basis_vectors_from_matrix(R)