Tutorials

basic

This tutorial is about the main classes of the libGeom : the `Vector` class, the `Point` class, the `Quaternion` class and the `Frame` class.

All is frame

The euclidean geometrical entities Vector, Point and Quaternion are expressed in a given frame. Some geometrical computations are very difficult to write (and read) when using uniquely a global frame. The frame management is a very powerful feature that allows us to write these geometrical operations in local frames. To express a Vector, a Point or a Quaternion in a local frame, you must pass this local frame as parameter of these object constructors. Note that :

• an item can’t change its reference frame.
• the operations between entities that are expressed in different frames are not allowed.
• the changing frame operations can be done through constructors.

To build a new frame, you need a Point, that models its center and a Quaternion, that models its orientation. The code snippet below highlights some feature of these geometrical entities.

You must be aware, changing frame operations are not obvious, you must remember in which frame your geom entities are expressed.

A point is not a vector

These two classes are quiet similar. However these two concepts are different. If you take a Point and a Vector with the same coordinate values, the changing frame operation will not give you the same result. In addition, mathematical operations, such as subtraction, cross product, etc… are not allowed with Point.

Under certain conditions, you need to consider a Point as a Vector. To do that, you can use the Point to Vector casting and vice versa as follows.