Translation.from_change_of_basis

classmethod Translation.from_change_of_basis(frame_from, frame_to)

Construct 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

Transformation – The transformation 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 = Transformation.from_change_of_basis(f1, f2)
>>> p_f1 = Point(1, 1, 1)  # point in f1
>>> p_f1.transformed(T)  # point represented in f2
Point(1.395, 0.955, 1.934)
>>> Frame.local_to_local_coordinates(f1, f2, p_f1)
Point(1.395, 0.955, 1.934)