Geometric Modeler |
Mathematics |
Using the Mathematical ClassesThe basic mathematical classes |
Use Case |
AbstractThis article discusses the CAAMthBase use case and explains how to use the mathematical classes. |
This use case is intended to help you to use the mathematical classes. It first gives general features on these classes, then proposes examples of use:
[Top]
The Mathematics framework provides the basic mathematical classes (such as planes, 2D/3D vectors, 2D/3D points, 2D/3D matrices) and their associated usual behavior: for example, the norm of a vector, the determinant, the trace or the inverse of a matrix.
These mathematical classes are concrete (as opposed to the interfaces), and are optimized to give the best performance. Their instances cannot be streamed. In fact, they are not dedicated to be stored but only to be used in a transient way.
The mathematical classes use the operators (+, *, ^), when this makes sense: hence, you can add two vectors with the + operator, or define a vector by subtracting a point to another one.
The methods of the mathematical classes always consider that their outputs are allocated by the caller: in that way, the caller completely manages the memory, and can optimize its use. Now, following the CAA naming conventions of the arguments, all their arguments must be named with the i prefix, even the outputs (resource allocated and deallocated by the caller). This is not very significant for distinguishing which is really modified. Hence, the "output" arguments are denoted with an io prefix.
[Top]
CAAMthBase is a use case of the CAAMathematics.edu framework that illustrates Mathematics framework capabilities.
[Top]
![]() |
In this use case, you use the CATMathPoint, CATMathVector, CATMathLine, CATMathAxis and CATMathTransformation classes. |
[Top]
To launch CAAMthBase, you will need to set up the build time environment, then compile CAAMthBase.m along with its prerequisites, set up the run time environment, and then execute the use case [1].
[Top]
The CAAMthBase use case is made of a main named CAAMthBase.cpp located in the CAAMthBase.m module of the CAAMathematics.edu framework:
Windows | InstallRootDirectory\CAAMathematics.edu\CAAMthBase.m\ |
Unix | InstallRootDirectory/CAAMathematics.edu/CAAMthBase.m/ |
where InstallRootDirectory
is the directory where the CAA CD-ROM
is installed.
[Top]
There are three logical sections in CAAMthBase:
We now comment each of those sections by looking at the code.
[Top]
Notice:
[Top]
The method to search the eigen values and vectors takes into account the case where there is no vector associated with an eigen value, that is to say when the dimension of the associated eigenspace is less than the multiplicity of the eigenvalue. Hence, the aHasAssociated array allows the caller to test whether this vector exists.
Notice also that all the arrays are allocated by the caller.
[Top]
To define the tranformation of an axis system into another one, one has to combine two transformations:
The constructor of CATMathAxis takes a point and three vectors as input arguments. If these arguments are omitted, default values are used.
CATMathAxis axis(A,U,V,W); | |
CATMathAxis axis(A,U,V); | W is by default the third canonical direction |
CATMathAxis axis(A,U); | W is by default the third canonical direction V is by default the second canonical direction |
CATMathAxis axis(A); | W is by default the third canonical direction V is by default the second canonical direction U is by default the first canonical direction |
CATMathAxis axis; | W is by default the third canonical direction V is by default the second canonical direction U is by default the first canonical direction A is by default the canonical origin |
The constructor uses the three input vectors as follows:
Although the input vectors can be not normalized and orthogonal, there resulting axis has three normalized and orthogonal directions.
[Top]
This article has proposed milestones to use the mathematical classes, and has illustrated them on some examples.
[Top]
[1] | Building and Launching a CAA V5 Use Case |
[Top] |
Version: 1 [Jan 2000] | Document created |
[Top] |
Copyright © 2000, Dassault Systèmes. All rights reserved.