matrix_from_change_of_basis

compas.geometry.matrix_from_change_of_basis(frame_from, frame_to)[source]

Computes a change of basis transformation between two frames.

A basis change is essentially a remapping of geometry from one coordinate system to another.

Parameters
  • frame_from (Frame) – A frame defining the original Cartesian coordinate system

  • frame_to (Frame) – A frame defining the targeted Cartesian coordinate system

Returns

list[list[float]] – A 4x4 transformation matrix representing a change of basis.

Examples

>>> from compas.geometry import Point, Frame
>>> f1 = Frame([2, 2, 2], [0.12, 0.58, 0.81], [-0.80, 0.53, -0.26])
>>> f2 = Frame([1, 1, 1], [0.68, 0.68, 0.27], [-0.67, 0.73, -0.15])
>>> T = matrix_from_change_of_basis(f1, f2)