Transformation.from_frame_to_frame

classmethod Transformation.from_frame_to_frame(frame_from, frame_to)

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

Transformation – The Transformation object representing a change of basis.

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 = Transformation.from_frame_to_frame(f1, f2)
>>> f1.transform(T)
>>> f1 == f2
True