C3D Toolkit  Kernel - 110464, Vision - 2.5.0.35

Polygon. More...

#include <mesh_primitive.h>

+ Inheritance diagram for MbPolygon3D:
+ Collaboration diagram for MbPolygon3D:

Public Member Functions

 MbPolygon3D ()
 Constructor without parameters.
 
virtual ~MbPolygon3D ()
 Destructor.
 
virtual MbePrimitiveType Type () const
 Get the object type.
 
virtual MbPolygon3DDuplicate (MbRegDuplicate *iReg=NULL) const =0
 Create a copy of primitive. More...
 
virtual void Transform (const MbMatrix3D &)=0
 Transform primitive according to the matrix. More...
 
virtual void Move (const MbVector3D &)=0
 Move primitive along a vector. More...
 
virtual void Rotate (const MbAxis3D &, double angle)=0
 Rotate primitive about an axis by a given angle. More...
 
virtual void AddYourGabaritTo (MbCube &) const =0
 Extend given bounding box so that it encloses the given object.
 
virtual double DistanceToPoint (const MbCartPoint3D &) const =0
 Calculate distance to point.
 
virtual double DistanceToLine (const MbAxis3D &, double maxDistance, double &t) const =0
 Calculate the distance to the axis.
 
virtual void GetProperties (MbProperties &)=0
 Get properties of the object.
 
virtual void SetProperties (const MbProperties &)=0
 Set properties of the object.
 
void GetPoints (std::vector< MbCartPoint3D > &pnts) const
 Get all the points of the polygon.
 
void GetPoints (std::vector< MbFloatPoint3D > &pnts) const
 Get all the points of the polygon.
 
Functions of polygon.
virtual size_t SizeOf () const =0
 Get the size of taken memory.
 
virtual void Reserve (size_t cnt)=0
 Reserve memory for polygon.
 
virtual void Adjust ()=0
 Free the unnecessary memory.
 
virtual void Flush ()=0
 Clear the polygon by deleting all the points.
 
virtual size_t Count () const =0
 Get count of points.
 
virtual void AddPoint (const MbCartPoint3D &dpnt)=0
 Add point to the end of the polygon.
 
virtual void AddPoint (const MbFloatPoint3D &fpnt)=0
 Add point to the end of the polygon.
 
virtual void GetPoint (size_t i, MbCartPoint3D &dp) const =0
 Get point by its index.
 
virtual void GetPoint (size_t i, MbFloatPoint3D &fp) const =0
 Get point by its index.
 
virtual void SetPoint (size_t i, MbCartPoint3D &pnt)=0
 Set point by index.
 
virtual bool IsPlanar (MbPlacement3D &plane, double metricAccuracy=Math::metricRegion) const =0
 
virtual bool GetPlanePolygon (MbPlacement3D &plane, MbPolygon &poly) const =0
 If points of polygon lie on the same plane, then initialize 'plane' and fill the 'poly' polygon.
 
virtual bool IsComplete () const =0
 Check existence of points in object.
 
const MbStepDataGetStepData () const
 Get the parameter of triangulation calculation.
 
void SetStepData (const MbStepData &stData)
 Set the parameter of triangulation calculation.
 
void SetStepBySag (double s)
 Set the parameter of polygon calculation (sag or angle of deviation).
 
virtual void AddPolygon (const MbPolygon3D &other)=0
 Add a polygon to the polygon with removing the coincident points of joint.
 
virtual void operator+= (const MbPolygon3D &other)=0
 Add a polygon to the polygon with removing the coincident points of joint.
 
virtual bool IsSame (const MbPolygon3D &other, double eps) const =0
 Determine whether objects are equal.
 
virtual void Init (const MbPolygon3D &other)=0
 Init by other polygon.
 
virtual MbPolyline3DCreatePolyline () const =0
 Create a polyline on the base of the polygon.
 
- Public Member Functions inherited from MbPrimitive
virtual ~MbPrimitive ()
 Destructor.
 
virtual MbeRefType RefType () const
 Registration type (for copying, duplication).
 
virtual MbeImplicationType ImplicationType () const
 Get attribute container type.
 
SimpleName GetPrimitiveName () const
 
void SetPrimitiveName (SimpleName n)
 
const MbRefItemGetItem () const
 Get begetter object of primitive.
 
void SetItem (const MbRefItem *g)
 Set begetter object of primitive.
 
MbeRefType GetPrimitiveType () const
 Get type of object.
 
void SetPrimitiveType (MbeRefType t)
 Set type of object.
 
bool NearestType (MbeSpaceType sType, MbeTopologyType tType, MbePlaneType pType) const
 Does the primitive satisfy the nearest object search criteria?
 
const MbSpaceItemSpaceItem () const
 Get spatial object for which the primitive is constructed.
 
const MbPlaneItemPlaneItem () const
 Get two-dimensional object for which the primitive is constructed.
 
const MbTopItemTopItem () const
 Get the topological object for which the primitive is constructed.
 
const MbItemItem () const
 Get geometric model object for which the primitive is constructed.
 
void PrimitiveRead (reader &in)
 Reading of primitive from the stream.
 
void PrimitiveWrite (writer &out) const
 Writing of primitive to the stream.
 
- Public Member Functions inherited from MbAttributeContainer
 MbAttributeContainer ()
 Constructor without parameters.
 
 MbAttributeContainer (MbAttribute &)
 Constructor by attribute.
 
virtual ~MbAttributeContainer ()
 Destructor.
 
void AttributesRead (reader &)
 Read attributes from stream.
 
void AttributesWrite (writer &) const
 Writing attributes to stream.
 
void GetProperties (MbProperties &)
 Get properties of attributes.
 
void SetProperties (const MbProperties &)
 Set properties of attributes.
 
void SetDensity (double)
 Set density of an object.
 
double GetDensity () const
 Get density of an object.
 
void SetVisual (float a, float d, float sp, float sh, float t, float e)
 Set visual properties of the object.
 
bool GetVisual (float &a, float &d, float &sp, float &sh, float &t, float &e) const
 Get visual properties of the object. More...
 
bool IsColored () const
 
void SetColor (uint32)
 Change color of the object.
 
void SetColor (int R, int G, int B)
 Change color of the object (0-255).
 
uint32 GetColor () const
 Get color of an object.
 
void SetWidth (int)
 Set thickness of lines for object's representation.
 
int GetWidth () const
 Get thickness of lines for object's representation.
 
void SetStyle (int)
 Set style of lines for object's representation.
 
int GetStyle () const
 Get style of lines for object's representation.
 
void SetSelected (bool s=true)
 To allocate or not to allocate an object.
 
bool IsSelected () const
 Is the object selected.
 
bool ReverseSelected ()
 Invert object selection.
 
void SetChanged (bool c=true)
 Set: the object is changed or isn't changed.
 
bool IsChanged () const
 Is the object changed?
 
void SetVisible (bool)
 Set visibility.
 
bool IsVisible () const
 Is the object visible?
 
bool IsInvisible () const
 Is the object invisible?
 
void AttributesAssign (const MbAttributeContainer &)
 Duplicate attributes of a given object, release existing attributes.
 
size_t AttributesCount () const
 Get the number of objects.
 
void RemoveAttributes (bool onDeleteOwner=false)
 Delete all attributes from container.
 
MbAttributeAddAttribute (MbAttribute *, bool checkSame=true)
 Add attribute in container.
 
MbAttributeAddAttribute (const MbAttribute &, bool checkSame=true)
 Add attribute in container (always copies the attribute).
 
void GetAttributes (c3d::AttrVector &, MbeAttributeType aFamily, MbeAttributeType subType) const
 Get attributes of a given family.
 
void GetAttributes (c3d::AttrVector &, MbeAttributeType aType) const
 Get attributes of a given type.
 
void GetCommonAttributes (c3d::AttrVector &, const c3d::string_t &samplePrompt, MbeAttributeType subType=at_Undefined) const
 Get attributes using sample of description string.
 
void GetStringAttributes (c3d::AttrVector &, const c3d::string_t &sampleContent) const
 Get string attributes using sample of contents of the string.
 
bool RemoveAttribute (const MbAttribute *, bool checkAccuracySame=false, double accuracy=LENGTH_EPSILON)
 Get an attribute of a given type, the first one is returned if there are many. More...
 
bool RemoveAttributes (MbeAttributeType type, MbeAttributeType subType)
 Delete attributes of a given type.
 
const MbAttributeGetSimpleAttribute (MbeAttributeType) const
 Get a simple attribute of a given subtype.
 
MbAttributeSetSimpleAttribute (MbeAttributeType)
 Get a simple attribute of a given subtype.
 
MbAttributeSetSimpleAttribute (MbAttribute *simpAttr)
 Set a simple attribute of a given subtype.
 
MbAttributeSetSimpleAttribute (const MbAttribute &simpAttr)
 Set a simple attribute of a given subtype (always copies the attribute).
 
void RemoveSimpleAttribute (MbeAttributeType)
 Delete simple attributes (one or more) of a given subtype.
 
MbAttributeDetachSimpleAttribute (MbeAttributeType)
 Detach a simple attribute of a given subtype.
 
void GetUserAttributes (std::vector< MbUserAttribute *> &attrs, const MbUserAttribType &type) const
 Get a user attribute of a given subtype.
 
void RemoveUserAttributes (const MbUserAttribType &type)
 Delete user attributes (one or more) of a given subtype.
 
void DetachUserAttributes (std::vector< MbUserAttribute *> &attrs, const MbUserAttribType &type)
 Detach a user attribute of a given subtype.
 
void AttributesChange ()
 Perform actions when changing the attributes.
 
void AttributesConvert (MbAttributeContainer &other) const
 Perform actions when converting the attributes.
 
void AttributesTransform (const MbMatrix3D &, MbRegTransform *=NULL)
 Perform actions when transforming the attributes.
 
void AttributesMove (const MbVector3D &, MbRegTransform *=NULL)
 Perform actions when moving the attributes.
 
void AttributesRotate (const MbAxis3D &, double angle, MbRegTransform *=NULL)
 Perform actions when rotating the attributes.
 
void AttributesCopy (MbAttributeContainer &other, MbRegDuplicate *=NULL) const
 Perform actions when copying the attributes.
 
void AttributesMerge (MbAttributeContainer &other)
 Perform actions when merging the attributes.
 
void AttributesReplace (MbAttributeContainer &other)
 Perform actions when replacing the attributes.
 
void AttributesSplit (const std::vector< MbAttributeContainer *> &others)
 Perform actions when splitting the attributes.
 
void AttributesDelete ()
 Perform actions when deleting the attributes.
 
- Public Member Functions inherited from MbRefItem
 MbRefItem ()
 Constructor without parameters.
 
refcount_t GetUseCount () const
 Get count of references (get count of owners of an object).
 
refcount_t AddRef () const
 Increase count of references by one.
 
refcount_t DecRef () const
 Decrease count of references by one.
 
refcount_t Release () const
 Decrease count of references by one and if count of references became zero, then remove itself.
 
- Public Member Functions inherited from MbNestSyncItem
void Lock () const
 Switch lock on (locking happens only in parallel region).
 
void Unlock () const
 Switch lock off if locking has been set.
 
CommonRecursiveMutexGetLock () const
 Get a pointer to the mutex object. Return NULL if no parallelism. For use in ScopedLock.
 

Protected Member Functions

 MbPolygon3D (const MbPolygon3D &, MbRegDuplicate *)
 Copy-constructor with the registrator.
 
- Protected Member Functions inherited from MbPrimitive
 MbPrimitive (const MbPrimitive &, MbRegDuplicate *iReg)
 Copy-constructor with the registrator.
 
 MbPrimitive ()
 Constructor without parameters.
 
- Protected Member Functions inherited from MbAttributeContainer
 MbAttributeContainer (const MbAttributeContainer &, MbRegDuplicate *)
 Copy-constructor with the registrator.
 

Protected Attributes

MbStepData stepData
 Parameters of polygon calculation (sag or angle of deviation).
 
MbCube cube
 Bounding box of a polygon (not read from stream and not written to stream). More...
 
- Protected Attributes inherited from MbPrimitive
SimpleName name
 Name of primitive.
 
const MbRefItemparentItem
 Begetter object (don't own).
 
MbeRefType type
 Type of primitive.
 

Additional Inherited Members

- Static Public Member Functions inherited from MbAttributeContainer
static MbUserAttributeReduceUserAttrib (const MbExternalAttribute &)
 Convert user attribute to "system" one.
 
static MbExternalAttributeAdvanceUserAttrib (const MbUserAttribute &)
 Convert "system" attribute to user one.
 

Detailed Description

Polygon.

Polygon is an ordered set of points in space, sequential connection of these points produces polyline that approximates an object or part of an object.

Member Function Documentation

◆ Duplicate()

virtual MbPolygon3D& MbPolygon3D::Duplicate ( MbRegDuplicate iReg = NULL) const
pure virtual

Create a copy of primitive.

Create a copy of primitive using the registrator. Registrator is used for preventing multiple copying of primitive contained in several simultaneously copied objects. It is allowed not to use the registrator while copying a single object or a set of disconnected objects. The registrator must be used to copy several correlated objects successively. Correlation is an existence of references to common primitives in objects. Then, while copying without using the registrator, one can get a set of copies which contains references to the different copies of a single included primitive, what leads to loss of connection between the copies.

Parameters
[in]iReg- Registrator.
Returns
The object copy.

Implements MbPrimitive.

Implemented in MbFloatPolygon3D, and MbExactPolygon3D.

◆ Transform()

virtual void MbPolygon3D::Transform ( const MbMatrix3D matr)
pure virtual

Transform primitive according to the matrix.

Transform primitive according to the matrix using the registrator. The registrator is used for preventing multiple transformation of primitive contained in several simultaneously transformed objects. The function can be used without the registrator to transform a single object. The registrator must be used to transform a set of interdependent objects to prevent repeated transformation of the nested primitives, since it is not ruled out that several objects from the set contain references to one or several common primitives subject to transformation.

Parameters
[in]matr- A transformation matrix.

Implements MbPrimitive.

Implemented in MbFloatPolygon3D, and MbExactPolygon3D.

◆ Move()

virtual void MbPolygon3D::Move ( const MbVector3D to)
pure virtual

Move primitive along a vector.

Move primitive along the vector using the registrator. The registrator is used for preventing multiple transformation of primitive contained in several simultaneously transformed objects. The function can be used without the registrator to transform a single object. The registrator must be used to transform a set of interdependent objects to prevent repeated transformation of the nested primitives, since it is not ruled out that several objects from the set contain references to one or several common primitives subject to moving.

Parameters
[in]to- Movement vector.

Implements MbPrimitive.

Implemented in MbFloatPolygon3D, and MbExactPolygon3D.

◆ Rotate()

virtual void MbPolygon3D::Rotate ( const MbAxis3D axis,
double  angle 
)
pure virtual

Rotate primitive about an axis by a given angle.

Rotate primitive about an axis by a given angle using the registrator. The registrator is used for preventing multiple transformation of primitive contained in several simultaneously transformed objects. The function can be used without the registrator to transform a single object. The registrator must be used to transform a set of interdependent objects to prevent repeated transformation of the nested primitives, since it is not ruled out that several objects from the set contain references to one or several common primitives subject to rotation.

Parameters
[in]axis- The rotation axis.
[in]angle- The rotation angle.

Implements MbPrimitive.

Implemented in MbFloatPolygon3D, and MbExactPolygon3D.

◆ IsPlanar()

virtual bool MbPolygon3D::IsPlanar ( MbPlacement3D plane,
double  metricAccuracy = Math::metricRegion 
) const
pure virtual

Check whether all points of polygon lie on the same plane with the given metricAccuracy accuracy. if so, then initialize 'plane' plane.

Implemented in MbFloatPolygon3D, and MbExactPolygon3D.

Member Data Documentation

◆ cube

MbCube MbPolygon3D::cube
mutableprotected

Bounding box of a polygon (not read from stream and not written to stream).

Bounding box of object is calculated only at the request. Bounding box of object is undefined after object constructor and after object modifications
.


The documentation for this class was generated from the following file: