Geometric Modeler |
Topology |
Basic Topological OperatorsHow to create vertex bodies or simple wire bodies |
Use Case |
AbstractBasic topological operators are transient objects for the creation of
basic topological bodies such as point, line or spline bodies. These
operators are based on the same scheme, which is described. The use of
each provided basic topological operator is presented in the |
This use case is intended to help you use the basic topological operators classes and presents an example of use for each provided basic topological operator: creation of a point body, a spline body, a line body, and length computation.
[Top]
Using basic topological operators is an easy way to create point, line, or spline bodies, that is to say: bodies only containing one vertex, or one wire whose geometry is a line or a spline.
These operators are called with parameters such as coordinates (to define a point), vectors (to define tangents), or other basic bodies. They work inside one geometric container: the input and output objects must belong to the same geometric container.
The basic topological operators create:
An additional operator, the CATLengthFromBodyOnWire
operator, analyzes the length between two point bodies.
[Top]
There are two ways to create basic bodies.
xxx
stands for the type of the created geometry of
the body). The created operator is transient (that is to say, it is not
streamed when streaming the geometric factory).The length analysis can be only used with the first way, except that there is no creation global function. In this case, the constructor is directly used.
[Top]
CAATopSpline is a use case of the CAATopologicalOperators.edu framework that illustrates TopologicalOperators framework capabilities.
[Top]
This use case details the two ways of creation of basic
bodies.
Moreover, the use case shows an example of the curve length computation. |
[Top]
To launch CAATopSpline, you will need to set up the build time environment, then compile CAATopSpline.m along with its prerequisites, set up the run time environment, and then execute the use case [1].
If you simply type CAATopSpline with no argument, the use case executes, but doesn't save the result in an NCGM file. If you want to save this result, provide the full pathname of the NCGM file to create. For example:
With Windows CAATopSpline e:\SplineCreation.NCGM
With UNIX CAATopSpline /u/SplineCreation.NCGM
This NCGM file can be displayed using the CAAGemBrowser use case.
[Top]
The CAATopSpline use case is made of a main named CAATopSpline.cpp located in the CAATopSpline.m module of the CAATopologicalOperators.edu framework:
Windows | InstallRootDirectory\CAATopologicalOperators.edu\CAATopSpline.m\ |
Unix | InstallRootDirectory/CAATopologicalOperators.edu/CAATopSpline.m/ |
where InstallRootDirectory
is the directory where the CAA CD-ROM
is installed.
[Top]
There are six steps in CAATopSpline.cpp:
[Top]
The geometry factory (CATGeoFactory) creates and manages all the CATICGMObject. This creation is done by the global function ::CATCreateCGMContainer. Notice that the factory can be defined by reading a NCGM file that was previously stored. In that case, the global function ::CATLoadCGMContainer must be used.
CATGeoFactory* piGeomFactory = ::CATCreateCGMContainer() ; if (NULL==piGeomFactory) return (1); |
[Top]
To operate in this way, you only have to call the global function ::CATCreateTopPoint or ::CATCreateTopSpline.
In case of the spline body creation, the created body is retrieved, but you cannot have access to the tangent or curvature at the passing points. To have them, you must use the operator, as in the next section.
The non detailed steps created or loaded the geometric factory (piGeomFactory).
The operator configuration is the level of software you want to use to run
this operator. By default, define an open configuration as in this use case to
run with the current level. Moreover here, the pointer to the journal is set to NULL
in the operator data. So that the journal is not filled.
[Top]
To operate in this mode, the sample proceeds with the following steps that:
[Top]
The CATLengthFromBodyOnWire
operator is directly constructed.
Then, it is run and the length is retrieved. Finally, it is deleted.
The l1
and l2 computed lengths are different, even
though they are computed between the same points, because the lengths are
computed on the splines, that are different.
// // 5- length computation // // between two points on the first spline CATLengthFromBodyOnWire* pLengthOp= new CATLengthFromBodyOnWire(piGeomFactory, aPoints[1], aPoints[2], piSplineBody ); double l1=0.; if (NULL != pLengthOp) { l1=pLengthOp->GetDistance(); delete pLengthOp; pLengthOp = NULL; } // between the same points on the second spline pLengthOp =new CATLengthFromBodyOnWire(piGeomFactory, aPoints[1], aPoints[2], piSplineBody2 ); // P2 will contain the 3D mathematical coordinates of the second point CATMathPoint P2; double l2=0.; if (NULL != pLengthOp) { l2=pLengthOp->GetDistance(NULL, // the coordinates of the first point are not asked &P2); // the coordinates of the second point delete pLengthOp; pLengthOp = NULL; } cout << "length 1 = " << l1 <<" , length2 "<< l2 << endl; |
[Top]
The point bodies have only been constructed to be used in the definition of the spline. Depending on your application, you may not need them afterwards. If you want to remove them from the geometric factory, use the CATICGMContainer::Remove method. If not, they will be automatically saved when streaming the factory.
Note: Although geometric objects are handled by the mean of
interfaces, such as CATCartesianPoint
, CATLine
, or CATBody
,
the pointers on these objects must not be released. In fact, they are released
at the closure of the factory (the CATCloseCGMContainer global
function).
// // 6- Delete the unused point bodies and the array // for (i=0;i <nbpts; i++) { piGeomFactory->Remove(aPoints[i],CATICGMContainer::RemoveDependancies); } delete [] aPoints; aPoints = NULL; |
[Top]
To save the model in a file, the ::CATSaveCGMContainer global function is used. Notice that in the use case, the save is conditioned by an input parameter representing the file inside which the model must be saved.
The use case ends with the closure of the geometry factory, done by the ::CATCloseCGMContainer global function.
if(1==toStore) { #ifdef _WINDOWS_SOURCE ofstream filetowrite(pfileName, ios::binary ) ; #else ofstream filetowrite(pfileName,ios::out,filebuf::openprot) ; #endif ::CATSaveCGMContainer(piGeomFactory,filetowrite); filetowrite.close(); } // // Closes the container // ::CATCloseCGMContainer(piGeomFactory); |
[Top]
[Top]
[1] | Building and Launching a CAA V5 Use Case |
[Top] |
Version: 1 [Feb 2000] | Document created |
[Top] |
Copyright © 2000, Dassault Systèmes. All rights reserved.