- Check your installation
- Running examples
- Building compact discrete domains
- Introduction to input file
- Plugins and input files
- Initialize project
- Initialize your first custom plugin
- Implement your first custom plugin
- Run your first project
- granoo-viewer usage
- Inputs/Outputs with GranOO
- Building a very simple tensile test
- Using numerical sensor
This page describes the usage of libGeom classes
This tutorial is about the main classes of the libGeom : the
Point class, the
Quaternion class and the
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.
Note that granoo does not raise classical exception error. Granoo is very strict, an error stops the program execution.
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.
Quaternions are used to express attitudes, angular velocities or angular accelerations. If you are not clear about the Quaternion concept, you can read the last part of the book Discrete Element Workbench for Highly Dynamic Thermo-mechanical Analysis: GranOO. This book explains step by step this advanced concept. The following example shows how to impose a rotation of pi/2 along the X axis to a vector.