matrix_from_frame_to_frame

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

Computes a transformation between two frames.

This transformation allows to transform geometry from one Cartesian coordinate system defined by “frame_from” to another Cartesian coordinate system defined by “frame_to”.

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 of list of float – A 4x4 transformation matrix representing the transformation from one frame to another.

Examples

>>> from compas.geometry import 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_frame_to_frame(f1, f2)