C3D Toolkit
Kernel - 117982, Vision - 2.9.2.2
|
Two-dimensional region. More...
#include <region.h>
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. | |
MbPlaneItem & | Duplicate (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. | |
MbProperty & | CreateProperty (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 MbContour * | GetContour (size_t k) const |
Get contour with the given index. | |
const MbContour * | GetOutContour () const |
Get external contour. | |
Functions for changing data | |
MbContour * | SetContour (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. | |
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.
|
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.
[in] | iReg | - Registrator. |
Implements MbPlaneItem.
|
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.
[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.
|
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.
[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.
|
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.
[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.
|
overridevirtual |
Determine whether objects are equal.
Objects of the same types with similar (equal) data are considered to be equal.
[in] | item | - Object for comparison. |
[in] | accuracy | - The accuracy. |
Implements MbPlaneItem.
|
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.
[in] | item | - Object for initialization. |
Implements MbPlaneItem.
|
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.
[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. |
Implements MbPlaneItem.
|
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.
[in] | to | - Point. |
[in,out] | d | - Specified distance from object on input. Distance from point to object on output if operation succeeded. |
Implements MbPlaneItem.
|
overridevirtual |
Get properties of the object.
Get internal data (properties) of an object for viewing and modification.
[in] | properties | - Container for internal data of an object. |
Implements MbPlaneItem.
|
overridevirtual |
Change properties of the object.
Change internal data (properties) of object is performed by copying of corresponding values from the given object.
[in] | properties | - Container for internal data of an object. |
Implements MbPlaneItem.
bool MbRegion::DeleteInnerContour | ( | size_t | index | ) |
Remove internal contour.
Remove internal contour by index. An index is validated for correctness.
[in] | index | - An index of internal contour. It should be more than null and less than the number of contours. |