C3D Toolkit  Kernel - 117978, Vision - 2.9.1.5

Two-dimensional region. More...

#include <region.h>

+ Inheritance diagram for MbRegion:
+ Collaboration diagram for MbRegion:

Public Member Functions

 MbRegion ()
 Empty region.
 
 MbRegion (const MbContour &, bool same)
 Region with one external contour.
 
 MbRegion (const SPtr< MbContour > &, bool same)
 Region with one external contour.
 
 MbRegion (const RPArray< MbContour > &, bool same)
 Region with several contours.
 
 MbRegion (const std::vector< SPtr< MbContour > > &, bool same)
 Region with several contours.
 
 MbRegion (const MbRegion &, bool same, MbRegDuplicate *iReg=nullptr)
 Copy-constructor.
 
Common functions of a geometric object.
MbePlaneType IsA () const override
 Get the object type.
 
MbePlaneType Type () const override
 Get the group type of the object.
 
MbePlaneType Family () const override
 Get family of object.
 
MbPlaneItemDuplicate (MbRegDuplicate *=nullptr) const override
 Create a copy. More...
 
void Transform (const MbMatrix &, MbRegTransform *=nullptr, const MbSurface *newSurface=nullptr) override
 Transform according to the matrix. More...
 
void Move (const MbVector &, MbRegTransform *=nullptr, const MbSurface *newSurface=nullptr) override
 Translate along a vector. More...
 
void Rotate (const MbCartPoint &, const MbDirection &angle, MbRegTransform *iReg=nullptr, const MbSurface *newSurface=nullptr) override
 Rotate about a point. More...
 
bool IsSame (const MbPlaneItem &, double accuracy=LENGTH_EPSILON) const override
 Determine whether objects are equal. More...
 
bool SetEqual (const MbPlaneItem &) override
 Make the objects equal. More...
 
void AddYourGabaritTo (MbRect &) const override
 Extend the given bounding rectangle so that it encloses this object.
 
bool IsVisibleInRect (const MbRect &, bool exact=false) const override
 Determine visibility of an object in rectangle. More...
 
double DistanceToPoint (const MbCartPoint &) const override
 Calculate the distance to a point.
 
bool DistanceToPointIfLess (const MbCartPoint &, double &distance) const override
 Calculate the distance to a point. More...
 
void Refresh () override
 Set all temporary (mutable) data of object to undefined (initial) state.
 
MbPropertyCreateProperty (MbePrompt) const override
 Create your own property with specified name.
 
void GetProperties (MbProperties &) override
 Get properties of the object. More...
 
void SetProperties (const MbProperties &) override
 Change properties of the object. More...
 
void GetBasisPoints (MbControlData &) const override
 Get control points of object.
 
void SetBasisPoints (const MbControlData &) override
 Change the object by control points.
 
Initialization functions.
void Init (const MbContour &, bool same)
 Initialization.
 
void Init (const RPArray< MbContour > &, bool same)
 Initialization.
 
void Init (const std::vector< SPtr< MbContour > > &, bool same)
 Initialization.
 
Functions for access to data.
size_t GetContoursCount () const
 Get the number of contours of region.
 
const MbContourGetContour (size_t k) const
 Get contour with the given index.
 
const MbContourGetOutContour () const
 Get external contour.
 
Functions for changing data
MbContourSetContour (size_t k)
 Get contour with the given index.
 
void DeleteContours ()
 Detach used contours and delete other.
 
template<class ContoursVector >
void DetachContours (ContoursVector &dstContours)
 Detach all region contours without deletion.
 
bool SetCorrect ()
 Make region correct (if this is possible).
 
ThreeStates GetCorrectState () const
 A state of region validation.
 
MbeItemLocation PointClassification (const MbCartPoint &, double metricAcc) const
 Define the point location relative to the region.
 
bool IsAnyCurvilinear () const
 Whether the contour has a curved segment.
 
bool IsSpaceSame (const MbRegion &) const
 Whether regions are space same.
 
void CalculatePolygons (double sag, RPArray< MbPolygon > &polygons) const
 Calculate and add arrays of drawn points with a given sag.
 
void DeleteInnerContours ()
 Remove internal contours.
 
bool DeleteInnerContour (size_t index)
 Remove internal contour. More...
 
- Public Member Functions inherited from MbPlaneItem
virtual ~MbPlaneItem ()
 Destructor.
 
void PrepareWrite () const
 Object registration. More...
 
MbeRefType RefType () const override
 Get the registration type (for copying, duplication).
 
virtual void Rotate (const MbCartPoint &pnt, double angle, MbRegTransform *iReg=nullptr, const MbSurface *newSurface=nullptr)
 Rotate about a point. More...
 
virtual bool IsSimilar (const MbPlaneItem &item) const
 Determine whether the objects are similar. More...
 
- Public Member Functions inherited from TapeBase
 TapeBase (RegistrableRec regs=noRegistrable)
 Constructor.
 
 TapeBase (const TapeBase &)
 Copy-constructor.
 
virtual ~TapeBase ()
 Destructor.
 
RegistrableRec GetRegistrable () const
 Whether the stream class is registrable.
 
void SetRegistrable (RegistrableRec regs=registrable) const
 Set the state of registration of the stream class.
 
virtual const char * GetPureName (const VersionContainer &) const
 Get the class name.
 
virtual bool IsFamilyRegistrable () const
 Whether the object belongs to a registrable family.
 
- Public Member Functions inherited from MbRefItem
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.
 

Additional Inherited Members

- Protected Member Functions inherited from MbPlaneItem
 MbPlaneItem ()
 Constructor.
 
- Protected Member Functions inherited from MbRefItem
 MbRefItem ()
 Constructor without parameters.
 

Detailed Description

Two-dimensional region.

A region consists of a set of closed composite curves (contours) MbContour.
A region represents a connected set of two-dimensional points, which boundaries are described by contours. Contours of region are closed and do not have self-intersections (but there may be self-contacts). In arbitrary region should be one (and only one) external contour (positive traverse of external contour is performed counterclockwise) and several internal contour (positive traverse of internal contour is performed clockwise) which are completely located inside external contour (or may contact it). In the array 'contours' external contour is always the first. Boolean operations may be performed with regions.

Member Function Documentation

◆ Duplicate()

MbPlaneItem& MbRegion::Duplicate ( MbRegDuplicate iReg = nullptr) const
overridevirtual

Create a copy.

Create a copy of the object using the registrator. The registrator is used for preventing multiple copying of an object. If the object contains references to other objects, then the included objects are copied too. It is allowed not to pass the registrator to a function. Then the new copy of the object will be created. 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. It is possible that the objects' connection means that the objects contain references to the common objects. Then, while copying without using the registrator, one can get a set of copies which contain references to the different copies of a single included object, what leads to loss of connection between the copies.

Parameters
[in]iReg- Registrator.
Returns
Copy of the object.

Implements MbPlaneItem.

◆ Transform()

void MbRegion::Transform ( const MbMatrix matr,
MbRegTransform iReg = nullptr,
const MbSurface newSurface = nullptr 
)
overridevirtual

Transform according to the matrix.

Transform the initial object according to the matrix using the registrator. If the object contains references to the other geometric objects, then the nested objects are transformed according to the matrix. The registrator is used for preventing multiple transformation of the object. 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 objects, since it is not ruled out that several objects from the set contain references to one or several common objects subject to transformation.

Parameters
[in]matr- A transformation matrix.
[in]iReg- Registrator.
[in]surface- New base surface of object provided that 'matr' is a transformation matrix from the old surface to a new one. For transformation of projection curve. It isn't considered if the surface is planar.

Implements MbPlaneItem.

◆ Move()

void MbRegion::Move ( const MbVector to,
MbRegTransform iReg = nullptr,
const MbSurface newSurface = nullptr 
)
overridevirtual

Translate along a vector.

Translate a geometric object along the vector using the registrator. If the object contains references to the other objects, then the translation operation is applied to the nested objects. The registrator is used for preventing multiple transformation of the object. 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 objects, since it is not ruled out that several objects from the set contain references to one or several common objects subject to translation.

Parameters
[in]to- Translation vector.
[in]iReg- Registrator.
[in]surface- New base surface of object provided that 'matr' is a transformation matrix from the old surface to a new one. For transformation of projection curve. It isn't considered if the surface is planar.

Implements MbPlaneItem.

◆ Rotate()

void MbRegion::Rotate ( const MbCartPoint pnt,
const MbDirection angle,
MbRegTransform iReg = nullptr,
const MbSurface newSurface = nullptr 
)
overridevirtual

Rotate about a point.

Rotate an object about a point by the given angle using the registrator. If the object contains references to the other geometric objects, then the rotation operation is applied to the nested objects too. The registrator is used for preventing multiple transformation of the object. 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 objects, since it is not ruled out that several objects from the set contain references to one or several common objects subject to rotation.

Parameters
[in]pnt- Fixed point.
[in]angle- The rotation angle.
[in]iReg- Registrator.
[in]surface- New base surface of object provided that 'matr' is a transformation matrix from the old surface to a new one. For transformation of projection curve. It isn't considered if the surface is planar.

Implements MbPlaneItem.

◆ IsSame()

bool MbRegion::IsSame ( const MbPlaneItem item,
double  accuracy = LENGTH_EPSILON 
) const
overridevirtual

Determine whether objects are equal.

Objects of the same types with similar (equal) data are considered to be equal.

Parameters
[in]item- Object for comparison.
[in]accuracy- The accuracy.
Returns
Whether the objects are equal.

Implements MbPlaneItem.

◆ SetEqual()

bool MbRegion::SetEqual ( const MbPlaneItem item)
overridevirtual

Make the objects equal.

It is possible to make equal only similar objects. Similar object is equated to a given one by changing of numerical data.

Parameters
[in]item- Object for initialization.
Returns
Whether the object is made equal to the given one.

Implements MbPlaneItem.

◆ IsVisibleInRect()

bool MbRegion::IsVisibleInRect ( const MbRect rect,
bool  exact = false 
) const
overridevirtual

Determine visibility of an object in rectangle.

It is considered that the object is visible in rectangle if bounds of an object is crossed with the given rectangle or (high requirements to accuracy, exact = true) at least one point of object is in the rectangle.

Parameters
[in]rect- Rectangle to check getting to.
[in]exact- Check accuracy. If exact = true, then at least one point of object gets to the rectangle. if exact = false, it is sufficient to find intersection between rectangle and bounding box of an object.
Returns
true, if the object is visible in the rectangle, otherwise false.

Implements MbPlaneItem.

◆ DistanceToPointIfLess()

bool MbRegion::DistanceToPointIfLess ( const MbCartPoint to,
double &  d 
) const
overridevirtual

Calculate the distance to a point.

Calculate distance to object from a given point near the object. Distance is calculated and stored to 'd' variable if it is less then initial value of 'd'. There can be performance benefit in comparison with DistanceToPoint function due to primarily checking the distance from point to bounding box and performing the further calculations only if this distance is not greater than the given one.

Parameters
[in]to- Point.
[in,out]d- Specified distance from object on input. Distance from point to object on output if operation succeeded.
Returns
True if distance from point to the object is less than the given one, otherwise false. Calculate the distance from a point and change the given value of distance if the distance is less than the given one.

Implements MbPlaneItem.

◆ GetProperties()

void MbRegion::GetProperties ( MbProperties properties)
overridevirtual

Get properties of the object.

Get internal data (properties) of an object for viewing and modification.

Parameters
[in]properties- Container for internal data of an object.

Implements MbPlaneItem.

◆ SetProperties()

void MbRegion::SetProperties ( const MbProperties properties)
overridevirtual

Change properties of the object.

Change internal data (properties) of object is performed by copying of corresponding values from the given object.

Parameters
[in]properties- Container for internal data of an object.

Implements MbPlaneItem.

◆ DeleteInnerContour()

bool MbRegion::DeleteInnerContour ( size_t  index)

Remove internal contour.

Remove internal contour by index. An index is validated for correctness.

Parameters
[in]index- An index of internal contour. It should be more than null and less than the number of contours.
Returns
True if the contour has been deleted.

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