Three-Dimensional Geometric Object MbSpaceItem

The MbSpaceItem class is declared in the space_item.h file.

The MbSpaceItem class is derived from the MbRefItem and TapeBase classes and is the base class for three-dimensional geometric objects.

The three-dimensional geometric objects of the C3D kernel include points, curves, surfaces, auxiliary objects and geometric model objects:

../../../../_images/O.2.2.1.png

The following families of three-dimensional geometric objects are derived from the MbSpaceItem class:

MbPoint3D is a point.

MbCurve3D is a curve.

MbSurface is a surface.

MbLegend is an auxiliary geometric object.

MbItem is a geometric model object.

The main methods of three-dimensional geometric objects are:

virtual void Move( const MbVector3D &      to,
                         MbRegTransform *  iReg = nullptr );

virtual void Rotate( const MbAxis3D &       axis,
                           double           angle,
                           MbRegTransform * iReg = nullptr );

virtual void Transform( const MbMatrix3D &     matr,
                              MbRegTransform * iReg = nullptr );

These methods perform geometric transformations of the object. When a transformation is applied, the MbRegTransform registrar is used to prevent repeated transformations of shared nested objects. If an object stores pointers or references to other objects, then the nested objects are also transformed. The registrar must be used when several related objects, which reference common nested objects, are transformed sequentially. If the transformation is performed without the registrar, shared nested objects can be transformed multiple times.

In addition, all geometric objects have methods that provide copying, checking for equality, checking for the possibility to make objects equal, and making objects equal:

// Create a copy of the object using the registrar
MbSpaceItem & Duplicate( MbRegDuplicate * iReg = nullptr );

// Determine whether the objects are equal
virtual bool IsSame( const MbSpaceItem & other,
                      double             accuracy = LENGTH_EPSILON );

// Determine whether the objects are similar
virtual bool IsSimilar( const MbSpaceItem & item );

// Make the objects equal if they are similar
virtual bool SetEqual( const MbSpaceItem & item );

When a copy is created, the MbRegDuplicate registrar is used to prevent repeated copying of shared nested objects. If an object stores pointers or references to other objects, then the nested objects are also copied. The registrar must be used when several related objects, which reference common nested objects, are copied sequentially. If copying is performed without the registrar, multiple copies of the same nested object may be created instead of a single shared copy.

To identify the type, geometric objects are provided with the following methods:

MbeSpaceType IsA();
MbeSpaceType Type();
MbeSpaceType Family();

These methods return a value of the enumeration of three-dimensional geometric object types.

The following methods

MbProperty & CreateProperty( MbePrompt name );

void GetProperties( MbProperties & properties );

void SetProperties( MbProperties & properties );

provide access to and editing of the internal data of geometric objects.

The GetProperties() method appends the object data to the properties collection in the form of descendants of the MbProperty class.

The CalculateWire( double sag, MbMesh & mesh ) method builds a polygonal copy of the geometric object which is used for visualization.