Translation.from_frame_to_frame

classmethod Translation.from_frame_to_frame(frame_from, frame_to)[source]

Construct 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_fromcompas.geometry.Frame

A frame defining the original Cartesian coordinate system.

frame_tocompas.geometry.Frame

A frame defining the targeted Cartesian coordinate system.

Returns:
compas.geometry.Transformation

The transformation.

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