Constructing a Polygonal Object
The virtual method of geometric model objects
MbItem * MbItem::CalculateMesh( const MbStepData & stepData,
const MbFormNote & note,
MbRegDuplicate * iReg ) const;
constructs a polygonal object that approximates the given geometric model object.
The input parameters of the method are:
stepData – data for calculating the approximation step;
note – method of constructing the polygonal object;
iReg – registrar of copied objects.
If the method succeeds, it returns a pointer to the newly constructed geometric model object MbItem; otherwise it returns null.
The method is declared in the item.h file and in the header files of MbItem inheritors.
This method approximates model objects by creating polygonal copies with a similar structure. For a solid, a wireframe and a point frame, the method creates a polygonal object MbMesh that approximates the original object and returns a pointer to the created object. Each triangulation grids[i] of the MbMesh object approximates the i-th face, each polygon wires[i] of the MbMesh object approximates the i-th edge, each apex peaks[i] of the MbMesh object approximates the i-th vertex. For a polygonal object MbMesh this method creates a polygonal copy. For an insertion this method creates an insertion with the object that this method creates for the insertion content. For an assembly unit this method creates an assembly unit with the objects that this method creates for the assembly unit objects.
The stepData parameter controls the density of the polygonal object mesh and contains data for calculating the step when moving along curves and surfaces of the model object. The note parameter defines the way to construct the polygonal object. The stepData and note parameters are described in the Triangulation_Calculation_Control paragraph. If note.wire == true, the method fills the set of polygon pointers mesh.wires; if note.grid == true, the method fills the set of triangulation pointers mesh.grids (for faces and surfaces), the set of polygon pointers mesh.wires (for edges), and the set of apex pointers mesh.peakes (for vertices).
The iReg parameter can be null. It is used to pass information about already processed objects to nested methods.
Fig. 1 shows a polygonal object of a solid constructed with note.wire == false, note.grid == true, containing triangulations, polygons and apexes. Fig. 2 shows a polygonal object of a solid constructed with note.wire == true, note.grid == false, containing only polygons.
Fig. 1
Fig. 2
Fig. 3 shows a polygonal object of an assembly unit constructed with note.wire == false, note.grid == true, consisting of an assembly unit of polygonal objects approximating the parts:
Fig. 3
This method is used to visualize geometric model objects. Polygonal objects are easy to transform, and intersections with a straight line can be found quickly for them. The screen displays exactly the polygonal copy of the geometric model object, while the object in its original representation remains behind the scenes.