CFx SDK Documentation 2024 SP0
Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | Static Public Attributes | List of all members
FacetModeler::Contour2D Class Reference

#include <FMContour2D.h>

Inheritance diagram for FacetModeler::Contour2D:
FacetModeler::Contour3D

Public Member Functions

 Contour2D ()
 
 Contour2D (ContourImplClass eImplClass)
 
 Contour2D (const IBulgeSeg2D &rSrcSeg, ContourImplClass eImplClass=ecicSimple)
 
 Contour2D (const Contour2D &rSrcCont, ContourImplClass eImplClass=ecicSimple)
 
 Contour2D (const IContour2D &rSrcCont, ContourImplClass eImplClass=ecicSimple)
 
 Contour2D (const OdGeExtents2d &ext)
 
Contour2Doperator= (const Contour2D &rSrcCont)
 
Contour2Doperator= (const IContour2D &rSrcCont)
 
Contour2DcloneFrom (const IContour2D &rSrcCont)
 
Contour2Dreset (ContourImplClass eImplClass=ecicUnknown)
 
ContourImplClass implClass () const
 
void swap (Contour2D &rAnother)
 
bool isClosed () const
 
bool isEndsEqual (const OdGeTol &gTol=FMGeGbl::gTol) const
 
void setClosed (bool bClosed=true)
 
bool isEmpty () const
 
OdUInt32 numVerts () const
 
OdUInt32 numSegments () const
 
bool hasArcs () const
 
SegmentType segmentType (OdUInt32 iIndex) const
 
Result getSegmentAt (OdUInt32 iIndex, Segment2D &rSegment) const
 
Result getSegmentAt (OdUInt32 iIndex, OdGePoint2d &ptStart, OdGePoint2d &ptEnd, double &dBulge) const
 
Result getLineSegAt (OdUInt32 iIndex, OdGeLineSeg2d &geLine) const
 
Result getArcSegAt (OdUInt32 iIndex, OdGeCircArc2d &geArc) const
 
Result getPointAt (OdUInt32 iIndex, OdGePoint2d &ptPoint) const
 
Result getBulgeAt (OdUInt32 iIndex, double &dBulge) const
 
Result getVertexAt (OdUInt32 iIndex, OdGePoint2d *pPoint, double *pBulge=NULL, OdIntPtr *pMetadata=NULL, OdUInt32 *puRawFlags=NULL) const
 
Result getInternalAngleAt (OdUInt32 iIndex, double &dAngle) const
 
Result setPointAt (OdUInt32 iIndex, const OdGePoint2d &ptPoint)
 
Result setBulgeAt (OdUInt32 iIndex, double dBulge)
 
Result setVertexAt (OdUInt32 iIndex, const OdGePoint2d &ptPoint, double dBulge)
 
void reserveVertices (OdUInt32 iReservedSize)
 
OdIntPtr metadataAt (OdUInt32 iIndex) const
 
Result setMetadataAt (OdUInt32 iIndex, OdIntPtr iNewData)
 
Result setAllMetadata (OdIntPtr iNewData, OdIntPtr iBitsToModify=(OdIntPtr) -1)
 
bool isHiddenAt (OdUInt32 iIndex) const
 
Result setHiddenAt (OdUInt32 iIndex, bool bHidden=true)
 
FaceOrientation orientationAt (OdUInt32 iIndex) const
 
Result setOrientationAt (OdUInt32 iIndex, FaceOrientation eOrientation)
 
bool threatAsSmoothCurveAt (OdUInt32 iIndex) const
 
void setThreatAsSmoothCurveAt (OdUInt32 iIndex, bool bSmooth)
 
bool isExplodedArcAt (OdUInt32 iIndex) const
 
Result setExplodedArcAt (OdUInt32 iIndex, bool bExplodedArc=true)
 
OdUInt32 rawFlagsAt (OdUInt32 iIndex) const
 
Result setRawFlagsAt (OdUInt32 iIndex, OdUInt32 iRawFlags)
 
Result addVertexAt (OdUInt32 iIndex, const OdGePoint2d &ptStart, double dBulge=0.0, OdIntPtr uMetadata=0, OdUInt32 uRawFlags=0)
 
Result appendVertex (const OdGePoint2d &ptStart, double dBulge=0.0, OdIntPtr uMetadata=0, OdUInt32 uRawFlags=0)
 
Result appendVertex (const OdGePoint2d &ptStart, const OdGePoint2d &ptMid, OdIntPtr uMetadata=0, OdUInt32 uRawFlags=0)
 
Result appendVertices (const OdGePoint2dArray &vecSource)
 
Result appendVertices (OdUInt32 size, const OdGePoint2d *vecSource, const double *bulgeSource=NULL)
 
Result appendSegment (const Segment2D &rSeg, bool bShiftToHit=false)
 
Result appendContour (const Contour2D &rCont, bool bCloseGap=false, double dMaxGap=1e99)
 
Result removeVertexAt (OdUInt32 iIndex)
 
Result getStartPoint (OdGePoint2d &ptPoint) const
 
Result getEndPoint (OdGePoint2d &ptPoint) const
 
Result getTangent (double dParam, OdGeVector2d &vTangent) const
 
Result getTangentAtDist (double dDist, OdGeVector2d &vTangent) const
 
Result getPoint (double dParam, OdGePoint2d &ptPoint) const
 
Result getPointAtDist (double dDist, OdGePoint2d &ptPoint) const
 
Result getDistAtParam (double dParam, double &dDist) const
 
Result getParamAtDist (double dDist, double &dParam) const
 
Result getNormalizedParam (double &dParam) const
 
Result getNormalizedDist (double &dDist) const
 
bool areEqualParams (double dParam1, double dParam2, double dParamTol=1e-10) const
 
bool areEqualDists (double dDist1, double dDist2, double dTol=1e-6) const
 
Result addExtents (OdGeExtents2d &extExtents) const
 
double startParam () const
 
double endParam () const
 
double length () const
 
double area () const
 
double signedArea () const
 
bool isConvex () const
 
bool isCCW () const
 
void makeCCW (bool bCCW=true)
 
bool isOn (const OdGePoint2d &ptTest, double *pParam=NULL, const OdGeTol &gTol=FMGeGbl::gTol) const
 
double nearestParam (const OdGePoint2d &ptTest, OdGePoint2d *ptNearest=NULL) const
 
bool contains (const OdGePoint2d &ptPoint, bool *pOnBorder=NULL, const OdGeTol &gTol=FMGeGbl::gTol) const
 
bool isSelfIntersecting (const OdGeTol &gTol=FMGeGbl::gTol, bool bExcludeTouch=false) const
 
bool isValidRegion (const OdGeTol &gTol=FMGeGbl::gTol) const
 
bool isInsideContour (const Contour2D &c2dOuter, bool fAllowBordersTouch=false, const OdGeTol &gTol=FMGeGbl::gTol) const
 
OdUInt32 intersect (const Segment2D &rSegB, std::vector< Intersection > &vecPoints, const OdGeTol &gTol=FMGeGbl::gTol) const
 
OdUInt32 intersect (const Contour2D &rContB, std::vector< Intersection > &vecPoints, const OdGeTol &gTol=FMGeGbl::gTol) const
 
OdUInt32 intersectLine (const OdGeLine2d &rLine, std::vector< Intersection > &vecPoints, const OdGeTol &gTol=FMGeGbl::gTol) const
 
Result transformBy (const OdGeMatrix2d &mMatrix, const DeviationParams &devDeviation=FMGeGbl::gDefDev)
 
void reverse ()
 
void deleteCoincident (const OdGeTol &gTol=FMGeGbl::gTol)
 
void mergeSegments (int iMergeFlags=0, const OdGeTol &gTol=FMGeGbl::gTol)
 
Result explode (const DeviationParams &devDeviation=FMGeGbl::gDefDev, OdIntPtr uArcMetadata=0)
 
Result explodeTo (Contour2D &rDestCont, const DeviationParams &devDeviation=FMGeGbl::gDefDev, OdIntPtr uArcMetadata=0) const
 
OdUInt32 createVertexAt (double dParam, const OdGeTol &gTol=FMGeGbl::gTol)
 
OdUInt32 createVertexAtDist (double dDist, const OdGeTol &gTol=FMGeGbl::gTol)
 
Result createVerticesAt (const std::vector< double > &vecParams, const OdGeTol &gTol=FMGeGbl::gTol)
 
Result createVerticesAt (OdUInt32 size, const double *vecParams, const OdGeTol &gTol=FMGeGbl::gTol)
 
Result getSubContour (double dStartParam, double dEndParam, Contour2D &rSubContour, const OdGeTol &gTol=FMGeGbl::gTol) const
 
Result getOffsetProfile (double dOffset, Profile2D &rResult, FilletType eFilletType=eftExtend, const OdGeTol &gTol=FMGeGbl::gTol) const
 
Result getProfileByOffsets (const std::vector< double > &adOffset, Profile2D &rResult, const OdGeTol &gTol=FMGeGbl::gTol) const
 
bool traverse (Contour2DTraversingReactor &reactor) const
 
void getGeomExtens (OdGeExtents2d &extens)
 
 ~Contour2D ()
 
 operator const IContour2D & () const
 
 operator IContour2D & ()
 
const IContour2Dimpl () const
 
IContour2Dimpl ()
 

Static Public Member Functions

static Contour2D createCircle (const OdGePoint2d &center, double radius)
 
static Contour2D createSquare (const OdGePoint2d &center, double side)
 

Static Public Attributes

static FMGEOMETRY_API_STATIC const Contour2D kNull
 

Detailed Description

Represents facet body 2D contour objects.

Remarks
Contour2D may contain linear and circular segments.

There are three ways to pick (non-vertex) points on the contour: a) Use an integer index to get a segment and then use a parameter on the segment (GeLine or GeArc). b) Use a distance along the curve from the starting point. c) Use a "parameter" value.

The last way is the fastest (and preferred in most cases) because of the "parameter" structure: dParam = startParam() + iIndex * (dOffsetOnSegment/dSegmentLength)

So the point given by the parameter value can be found fast consistently.

Definition at line 118 of file FMContour2D.h.

Constructor & Destructor Documentation

◆ Contour2D() [1/6]

FacetModeler::Contour2D::Contour2D ( )

Default constructor. Creates a contour of the eSimple implementation type.

◆ Contour2D() [2/6]

FacetModeler::Contour2D::Contour2D ( ContourImplClass  eImplClass)
explicit

Creates a contour of the specified implementation type.

Parameters
eImplClass[in] Implementation type.

◆ Contour2D() [3/6]

FacetModeler::Contour2D::Contour2D ( const IBulgeSeg2D rSrcSeg,
ContourImplClass  eImplClass = ecicSimple 
)
explicit

Creates a contour of the eSimple implementation type by the specified segment.

Parameters
rSrcSeg[in] Input segment to create the contour.
eImplClass[in] Optional argument representing a Contour2D implementation type of the object to create. Default value is ecicSimple.

◆ Contour2D() [4/6]

FacetModeler::Contour2D::Contour2D ( const Contour2D rSrcCont,
ContourImplClass  eImplClass = ecicSimple 
)

Copy constructor. Creates a contour of the eSimple implementation type and initializes it with parameters of the specified contour.

Parameters
rSrcCont[in] Contour2D object to copy.
eImplClass[in] Optional argument representing a Contour2D implementation type of the object to create. Default value is ecicSimple.

◆ Contour2D() [5/6]

FacetModeler::Contour2D::Contour2D ( const IContour2D rSrcCont,
ContourImplClass  eImplClass = ecicSimple 
)
explicit

Creates a contour of the eImplClass implementation type with the specified contour implementation object.

Parameters
rSrcCont[in] Contour2D implementation to initialize.
eImplClass[in] Optional argument representing a Contour2D implementation type of the object to create. Default value is ecicSimple.

◆ Contour2D() [6/6]

FacetModeler::Contour2D::Contour2D ( const OdGeExtents2d ext)

Creates a rectangular contour with the specified extent points.

Parameters
ext[in] Rectangle as OdGeExtents2d.

◆ ~Contour2D()

FacetModeler::Contour2D::~Contour2D ( )

Destructor.

Member Function Documentation

◆ addExtents()

Result FacetModeler::Contour2D::addExtents ( OdGeExtents2d extExtents) const

Appends the extents of the contour to the specified extents structure.

Parameters
extExtents[in/out] Extents to add to.
Returns
Reference to this object.

◆ addVertexAt()

Result FacetModeler::Contour2D::addVertexAt ( OdUInt32  iIndex,
const OdGePoint2d ptStart,
double  dBulge = 0.0,
OdIntPtr  uMetadata = 0,
OdUInt32  uRawFlags = 0 
)

Adds a vertex at the specified index.

Parameters
iIndex[in] Vertex index to append.
ptStart[in] Vertex point to append.
dBulge[in] (Optional) Arc segment bulge. Default value is 0.0.
uMetadata[in] (Optional) Metadata to set. Default value is 0.
uRawFlags[in] (Optional) Raw flags to set. Default value is 0.
Returns
eOk if the vertex appended successfully, or a corresponding error type otherwise.
Remarks
The index must be less than or equal to the number of vertices in the contour.

◆ appendContour()

Result FacetModeler::Contour2D::appendContour ( const Contour2D rCont,
bool  bCloseGap = false,
double  dMaxGap = 1e99 
)

Appends a contour to the end of this contour.

Parameters
rCont[in] Contour to append.
bCloseGap[in] If true, a segment connecting the points is inserted and the return code is erWarnPointNotOnThis.
dMaxGap[in] (Optional) The maximum allowable distance between the ends of the connected contours. Default value is 1e99.
Returns
eOk - If the contour is appended successfully. erInvalidArgs - If rCont is equal to this contour. erPointNotOnThis - If rCont.startPoint is not equal to the end of this (open) contour. erWarnPointNotOnThis - If the distance from rCont.startPoint to the end of this contour is greater than FMGeGbl :: gTol.equalPoint (), but less than dMaxGap.

◆ appendSegment()

Result FacetModeler::Contour2D::appendSegment ( const Segment2D rSeg,
bool  bShiftToHit = false 
)

Appends a segment to the end of this contour.

Parameters
rSeg[in] Segment to add.
bShiftToHit[in] (Optional) true to enable shift correction, or false for disable. Default value is false.
Returns
eOk - If the segment is appended successfully, or a corresponding error type otherwise. erPointNotOnThis - If bShiftToHit is false and rSeg.startPt() is not equal to the end of this (open) contour. erWarnPointNotOnThis - If bShiftToHit is true and the rSeg is shifted.

◆ appendVertex() [1/2]

Result FacetModeler::Contour2D::appendVertex ( const OdGePoint2d ptStart,
const OdGePoint2d ptMid,
OdIntPtr  uMetadata = 0,
OdUInt32  uRawFlags = 0 
)

Appends a new vertex to the end of the contour.

Parameters
ptStart[in] Vertex point to append.
ptMid[in] Middle point of bulge to calculate.
uMetadata[in] Metadata pointer to set.
uRawFlags[in] Raw flags to set.
Returns
eOk if the vertex appended successfully, or a corresponding error type otherwise.

◆ appendVertex() [2/2]

Result FacetModeler::Contour2D::appendVertex ( const OdGePoint2d ptStart,
double  dBulge = 0.0,
OdIntPtr  uMetadata = 0,
OdUInt32  uRawFlags = 0 
)

Appends a new vertex to the end of the contour.

Parameters
ptStart[in] Vertex point to append.
dBulge[in] (Optional) Arc segment bulge. Default value is 0.0.
uMetadata[in] (Optional) Metadata to set. Default value is 0.
uRawFlags[in] (Optional) Raw flags to set. Default value is 0.
Returns
eOk if the vertex appended successfully, or a corresponding error type otherwise.
Remarks
The bulge value relates to the segment starting at this point.

◆ appendVertices() [1/2]

Result FacetModeler::Contour2D::appendVertices ( const OdGePoint2dArray vecSource)

Appends vertices to the end of this contour.

Parameters
vecSource[in] Array of vertices to append as OdGePoint2dArray.
Returns
eOk if the vertices array appended successfully, or a corresponding error type otherwise.

◆ appendVertices() [2/2]

Result FacetModeler::Contour2D::appendVertices ( OdUInt32  size,
const OdGePoint2d vecSource,
const double *  bulgeSource = NULL 
)

Appends vertices to the end of this contour.

Parameters
size[in] Number of points to add.
vecSource[in] Pointer to an array of points.
bulgeSource[in] (Optional) Pointer to an array of bulge values. The array must be the same size as vecSource.
Returns
eOk if the vertices array appended successfully, or a corresponding error type otherwise.

◆ area()

double FacetModeler::Contour2D::area ( ) const

Gets the non-negative area of the contour.

Returns
Non-negative area of the contour.
Remarks
For open contours, the first and last vertices are considered to be connected with a straight line.

◆ areEqualDists()

bool FacetModeler::Contour2D::areEqualDists ( double  dDist1,
double  dDist2,
double  dTol = 1e-6 
) const

Checks whether the specified distances are equal depending on the closed state of the contour.

Parameters
dDist1[in] First distance.
dDist2[in] Second distance.
dTol[in] Tolerance.
Returns
true if the distances are equal (after normalization), or false otherwise.
Remarks
The result is useless unless both distances are valid.

◆ areEqualParams()

bool FacetModeler::Contour2D::areEqualParams ( double  dParam1,
double  dParam2,
double  dParamTol = 1e-10 
) const

Checks whether the specified parameters are equal depending on the closed state of the contour.

Parameters
dParam1[in] First parameter.
dParam2[in] Second parameter.
dParamTol[in] Tolerance.
Returns
true if the parameters are valid and equal (after normalization), or false otherwise.

◆ cloneFrom()

Contour2D & FacetModeler::Contour2D::cloneFrom ( const IContour2D rSrcCont)

Clones the contents of the specified contour.

Parameters
rSrcCont[in] Contour implementation to clone.
Returns
Reference to the resulting object.
Remarks
The implementation type may change.

◆ contains()

bool FacetModeler::Contour2D::contains ( const OdGePoint2d ptPoint,
bool *  pOnBorder = NULL,
const OdGeTol gTol = FMGeGbl::gTol 
) const

Checks whether a point is inside the contour, at its boundary, or outside.

Parameters
ptPoint[in] Point to check.
pOnBorder[out] (Optional) true if the point is located on the contour border.
gTol[in] Tolerance.
Returns
true if the point lies inside the contour with the specified tolerance, or false otherwise.

◆ createCircle()

static Contour2D FacetModeler::Contour2D::createCircle ( const OdGePoint2d center,
double  radius 
)
static

Creates Contour2D as full circle with center point and radius specified.

Parameters
center[in] Coordinates of center.
radius[in] Radius value.
Returns
Circular contour as Contour2D.

◆ createSquare()

static Contour2D FacetModeler::Contour2D::createSquare ( const OdGePoint2d center,
double  side 
)
static

Creates Contour2D as square with center point and side length specified.

Parameters
center[in] Coordinates of center.
side[in] Side length value.
Returns
Square contour as Contour2D.

◆ createVertexAt()

OdUInt32 FacetModeler::Contour2D::createVertexAt ( double  dParam,
const OdGeTol gTol = FMGeGbl::gTol 
)

Adds a vertex to the contour at the specified parameter value.

Parameters
dParam[in] Parameter to create a vertex.
gTol[in] Tolerance.
Returns
Index of created (or found) vertex.
Remarks
If a vertex at the specified parameter exists, the method does nothing.

Insertion or removal of a vertex at dParam invalidates all parameters greater than floor(dParam).

◆ createVertexAtDist()

OdUInt32 FacetModeler::Contour2D::createVertexAtDist ( double  dDist,
const OdGeTol gTol = FMGeGbl::gTol 
)

Adds a vertex to the contour at the specified distance.

Parameters
dDist[in] Distance on the contour to add the vertex at.
gTol[in] Tolerance.
Returns
Index of the created (or found) vertex.
Remarks
If a vertex at the specified parameter exists, the method does nothing.

◆ createVerticesAt() [1/2]

Result FacetModeler::Contour2D::createVerticesAt ( const std::vector< double > &  vecParams,
const OdGeTol gTol = FMGeGbl::gTol 
)

Adds vertices at the specified parameters into the contour.

Parameters
vecParams[in] Array of parameters.
gTol[in] Tolerance.
Returns
eOk if the vertices are added successfully, or a corresponding error type otherwise.
Remarks
If some vertices already exist, this method doesn't create them.

◆ createVerticesAt() [2/2]

Result FacetModeler::Contour2D::createVerticesAt ( OdUInt32  size,
const double *  vecParams,
const OdGeTol gTol = FMGeGbl::gTol 
)

Adds vertices at the specified parameters into the contour.

Parameters
size[in] The number of elements in the parameter array.
vecParams[in] Pointer to an array of parameters.
gTol[in] Tolerance.
Returns
eOk if the vertices are added successfully, or a corresponding error type otherwise.
Remarks
If some vertices already exist, this method doesn't create them.

◆ deleteCoincident()

void FacetModeler::Contour2D::deleteCoincident ( const OdGeTol gTol = FMGeGbl::gTol)

Removes redundant segments with zero length.

Parameters
gTol[in] Tolerance.

◆ endParam()

double FacetModeler::Contour2D::endParam ( ) const

Gets the end contour parameter.

Returns
End contour parameter value.

◆ explode()

Result FacetModeler::Contour2D::explode ( const DeviationParams devDeviation = FMGeGbl::gDefDev,
OdIntPtr  uArcMetadata = 0 
)

Explodes all arc segments to lines. Sets the uArcMetadata flag on exploded segments.

Parameters
devDeviation[in] Deviation parameters.
uArcMetadata[in] Metadata to set.
Returns
eOk if the contour is exploded successfully, or a corresponding error type otherwise.

◆ explodeTo()

Result FacetModeler::Contour2D::explodeTo ( Contour2D rDestCont,
const DeviationParams devDeviation = FMGeGbl::gDefDev,
OdIntPtr  uArcMetadata = 0 
) const

Explodes all arc segments to lines. Sets the uArcMetadata flag on exploded segments.

Parameters
rDestCont[out] Destination contour for exploded lines.
devDeviation[in] Deviation parameters.
uArcMetadata[in] Metadata to set.
Returns
eOk if the contour is exploded successfully, or a corresponding error type otherwise.

◆ getArcSegAt()

Result FacetModeler::Contour2D::getArcSegAt ( OdUInt32  iIndex,
OdGeCircArc2d geArc 
) const

Gets a circular arc segment by the specified index.

Parameters
iIndex[in] Segment index.
geArc[out] Resulting arc segment as OdGeCircArc2d.
Returns
eOk if the arc segment is found successfully, or a corresponding error type otherwise.

◆ getBulgeAt()

Result FacetModeler::Contour2D::getBulgeAt ( OdUInt32  iIndex,
double &  dBulge 
) const

Gets a bulge value of a segment with the specified index.

Parameters
iIndex[in] Segment index.
dBulge[out] Bulge value.
Returns
eOk if the bulge is found successfully, or a corresponding error type otherwise.

◆ getDistAtParam()

Result FacetModeler::Contour2D::getDistAtParam ( double  dParam,
double &  dDist 
) const

Gets a distance from the start point to the specified parameter.

Parameters
dParam[in] Parameter.
dDist[out] Resulting distance.
Returns
Distance to the parameter.

◆ getEndPoint()

Result FacetModeler::Contour2D::getEndPoint ( OdGePoint2d ptPoint) const

Gets the end point of the contour.

Parameters
ptPoint[out] Resulting end point as OdGePoint2d.
Returns
eOk if the point is calculated, or a corresponding result state otherwise.
Remarks
If the contour is empty, it has no end point.

◆ getGeomExtens()

void FacetModeler::Contour2D::getGeomExtens ( OdGeExtents2d extens)

Gets the geometry extents.

Parameters
extens[out] Resulting extents as OdGeExtents2d.

◆ getInternalAngleAt()

Result FacetModeler::Contour2D::getInternalAngleAt ( OdUInt32  iIndex,
double &  dAngle 
) const

Gets an internal angle of a vertex with the specified index.

Parameters
iIndex[in] Vertex index.
dAngle[out] Internal angle value.
Returns
eOk if the internal angle is found successfully, or a corresponding error type otherwise.

◆ getLineSegAt()

Result FacetModeler::Contour2D::getLineSegAt ( OdUInt32  iIndex,
OdGeLineSeg2d geLine 
) const

Gets a linear segment by the specified index.

Parameters
iIndex[in] Segment index.
geLine[out] Resulting line segment as OdGeLineSeg2d.
Returns
eOk if the line segment is found successfully, or a corresponding error type otherwise.

◆ getNormalizedDist()

Result FacetModeler::Contour2D::getNormalizedDist ( double &  dDist) const

Converts a distance to the [0, length] range.

Parameters
dDist[in/out] Distance to normalize.
Returns
eOk if dParam is valid, or a corresponding error type otherwise.
Remarks
Works for closed contours.

◆ getNormalizedParam()

Result FacetModeler::Contour2D::getNormalizedParam ( double &  dParam) const

Converts a parameter to the [start param, end param] range.

Parameters
dParam[in/out] Parameter to normalize.
Returns
eOk if dParam is valid, or a corresponding error type otherwise.
Remarks
Works for closed contours.

◆ getOffsetProfile()

Result FacetModeler::Contour2D::getOffsetProfile ( double  dOffset,
Profile2D rResult,
FilletType  eFilletType = eftExtend,
const OdGeTol gTol = FMGeGbl::gTol 
) const

Gets the profile that is shifted in the normal direction from this closed contour. E.g., if dOffset is negative, a counter-clockwise circle is extended. If dOffset is positive and small enough, it is contracted, and becomes empty if dOffset > radius.

Parameters
dOffset[in] Signed offset along the normal direction. A positive offset is towards the inside for CCW contours.
rResult[out] Resulting profile.
eFilletType[in] Gap filling strategy for the segments sliding apart.
gTol[in] Tolerance.
Returns
eOk if the profile is computed successfully, or a corresponding error type otherwise.

◆ getParamAtDist()

Result FacetModeler::Contour2D::getParamAtDist ( double  dDist,
double &  dParam 
) const

Gets a parameter at the specified distance from the start point.

Parameters
dDist[in] Distance.
dParam[out] Resulting param.
Returns
Parameter at the distance.

◆ getPoint()

Result FacetModeler::Contour2D::getPoint ( double  dParam,
OdGePoint2d ptPoint 
) const

Gets a point on the contour at the specified parameter.

Parameters
dParam[in] Parameter.
ptPoint[out] Resulting point.
Returns
eOk if the point is calculated, or a corresponding result state otherwise.

◆ getPointAt()

Result FacetModeler::Contour2D::getPointAt ( OdUInt32  iIndex,
OdGePoint2d ptPoint 
) const

Gets a point by the specified index.

Parameters
iIndex[in] Vertex index.
ptPoint[out] Vertex point as OdGePoint2d.
Returns
eOk if the point is found successfully, or a corresponding error type otherwise.

◆ getPointAtDist()

Result FacetModeler::Contour2D::getPointAtDist ( double  dDist,
OdGePoint2d ptPoint 
) const

Gets a point on the contour at the specified distance.

Parameters
dDist[in] Distance.
ptPoint[out] Resulting point.
Returns
eOk if the point is calculated, or a corresponding result state otherwise.

◆ getProfileByOffsets()

Result FacetModeler::Contour2D::getProfileByOffsets ( const std::vector< double > &  adOffset,
Profile2D rResult,
const OdGeTol gTol = FMGeGbl::gTol 
) const

Gets the profile that is shifted in the normal direction from this closed contour.

Parameters
adOffset[in] Array of the signed offset along the normal direction. A positive offset is inside for CCW contours.
rResult[out] Resulting profile.
gTol[in] Tolerance.
Returns
eOk if the profile is computed successfully, or a corresponding error type otherwise.
See also
getOffsetProfile

◆ getSegmentAt() [1/2]

Result FacetModeler::Contour2D::getSegmentAt ( OdUInt32  iIndex,
OdGePoint2d ptStart,
OdGePoint2d ptEnd,
double &  dBulge 
) const

Gets parameters of the segment specified by the index.

Parameters
iIndex[in] Segment index.
ptStart[out] Start point as OdGePoint2d.
ptEnd[out] End point as OdGePoint2d.
dBulge[out] Bulge value.
Returns
eOk if the segment is found successfully, or a corresponding error type otherwise.

◆ getSegmentAt() [2/2]

Result FacetModeler::Contour2D::getSegmentAt ( OdUInt32  iIndex,
Segment2D rSegment 
) const

Gets a segment by the specified index.

Parameters
iIndex[in] Segment index.
rSegment[out] Found segment.
Returns
eOk if the segment is found successfully, or a corresponding error type otherwise.

◆ getStartPoint()

Result FacetModeler::Contour2D::getStartPoint ( OdGePoint2d ptPoint) const

Gets the start point of the contour.

Parameters
ptPoint[out] Resulting start point as OdGePoint2d.
Returns
eOk if the point is calculated, or a corresponding result state otherwise.
Remarks
If the contour is empty, the contour has no start point.

◆ getSubContour()

Result FacetModeler::Contour2D::getSubContour ( double  dStartParam,
double  dEndParam,
Contour2D rSubContour,
const OdGeTol gTol = FMGeGbl::gTol 
) const

Gets a sub-contour given by two parameters.

Parameters
dStartParam[in] The lower bound on which to create a sub-contour.
dEndParam[in] The upper bound on which to create a sub-contour.
rSubContour[out] Resulting sub-contour.
gTol[in] Tolerance.
Returns
eOk if the sub-contour is computed successfully, or a corresponding error type otherwise.
Remarks
If (dStartParam > dEndParam), the rSubContour has the opposite direction.

◆ getTangent()

Result FacetModeler::Contour2D::getTangent ( double  dParam,
OdGeVector2d vTangent 
) const

Gets a tangent to the contour at the specified parameter.

Parameters
dParam[in] Parameter to calculate the tangent at.
vTangent[out] Resulting tangent vector as OdGeVector2d.
Returns
eOk if the tangent is calculated, or a corresponding result state otherwise.

◆ getTangentAtDist()

Result FacetModeler::Contour2D::getTangentAtDist ( double  dDist,
OdGeVector2d vTangent 
) const

Gets a tangent at the distance along the contour starting from the start point.

Parameters
dDist[in] Distance.
vTangent[out] Resulting tangent vector as OdGeVector2d.
Returns
eOk if the tangent is calculated, or a corresponding result state otherwise.

◆ getVertexAt()

Result FacetModeler::Contour2D::getVertexAt ( OdUInt32  iIndex,
OdGePoint2d pPoint,
double *  pBulge = NULL,
OdIntPtr pMetadata = NULL,
OdUInt32 puRawFlags = NULL 
) const

Gets data of a vertex with the specified index.

Parameters
iIndex[in] Vertex index.
pPoint[out] Vertex point as OdGePoint2d.
pBulge[out] (Optional) Bulge value.
pMetadata[out] (Optional) Metadata attribute.
puRawFlags[out] (Optional) Flags as a raw OdUInt32 value.
Returns
eOk if the vertex is found successfully, or a corresponding error type otherwise.

◆ hasArcs()

bool FacetModeler::Contour2D::hasArcs ( ) const

Checks whether the contour has arcs.

Returns
true if the contour contains at least one arc, or false otherwise.

◆ impl() [1/2]

IContour2D & FacetModeler::Contour2D::impl ( )
inline

Definition at line 1167 of file FMContour2D.h.

◆ impl() [2/2]

const IContour2D & FacetModeler::Contour2D::impl ( ) const
inline

Definition at line 1165 of file FMContour2D.h.

◆ implClass()

ContourImplClass FacetModeler::Contour2D::implClass ( ) const

Gets the implementation type.

Returns
The implementation type.

◆ intersect() [1/2]

OdUInt32 FacetModeler::Contour2D::intersect ( const Contour2D rContB,
std::vector< Intersection > &  vecPoints,
const OdGeTol gTol = FMGeGbl::gTol 
) const

Calculates all intersections with the specified contour and appends the result to vecPoints.

Parameters
rContB[in] Other contour this contour is intersected with.
vecPoints[out] Intersection container the result is appended to.
gTol[in] Tolerance.
Returns
The number of intersections.

◆ intersect() [2/2]

OdUInt32 FacetModeler::Contour2D::intersect ( const Segment2D rSegB,
std::vector< Intersection > &  vecPoints,
const OdGeTol gTol = FMGeGbl::gTol 
) const

Calculates all intersections with the specified segment and appends the result to vecPoints.

Parameters
rSegB[in] Segment this contour is intersected with.
vecPoints[out] Intersection container the result is appended to.
gTol[in] Tolerance.
Returns
The number of intersections.

◆ intersectLine()

OdUInt32 FacetModeler::Contour2D::intersectLine ( const OdGeLine2d rLine,
std::vector< Intersection > &  vecPoints,
const OdGeTol gTol = FMGeGbl::gTol 
) const

Calculates all intersections with the specified line and appends the result to vecPoints.

Parameters
rLine[in] Line this contour is intersected with.
vecPoints[out] Intersection container the result is appended to.
gTol[in] Tolerance.
Returns
The number of intersections.

◆ isCCW()

bool FacetModeler::Contour2D::isCCW ( ) const

Gets the orientation of the contour.

Returns
true if the contour has counter-clockwise orientation, or false otherwise.
Remarks
The area of the contour is positive for a counter-clockwise contour and negative for a clockwise contour.

◆ isClosed()

bool FacetModeler::Contour2D::isClosed ( ) const

Checks whether the contour is closed.

Returns
true if the contour is closed, or false otherwise.

◆ isConvex()

bool FacetModeler::Contour2D::isConvex ( ) const

Checks whether the contour is convex.

Returns
true if the contour is convex, or false otherwise.

◆ isEmpty()

bool FacetModeler::Contour2D::isEmpty ( ) const

Checks whether the contour is empty.

Returns
true if contour has no vertices, or false otherwise.

◆ isEndsEqual()

bool FacetModeler::Contour2D::isEndsEqual ( const OdGeTol gTol = FMGeGbl::gTol) const

Checks whether the start and the end of the contour are equal to the specified tolerance.

Parameters
gTol[in] Tolerance.
Returns
true if equal, or false otherwise.

◆ isExplodedArcAt()

bool FacetModeler::Contour2D::isExplodedArcAt ( OdUInt32  iIndex) const

Gets the ecfExplodedArc flag value at the specified segment.

Parameters
iIndex[in] Segment index.
Returns
true if the segment with the specified index is part of an exploded arc.

◆ isHiddenAt()

bool FacetModeler::Contour2D::isHiddenAt ( OdUInt32  iIndex) const

Checks whether the segment with the specified index is hidden.

Parameters
iIndex[in] Segment index.
Returns
true if the segment with the specified index in hidden, or false otherwise.

◆ isInsideContour()

bool FacetModeler::Contour2D::isInsideContour ( const Contour2D c2dOuter,
bool  fAllowBordersTouch = false,
const OdGeTol gTol = FMGeGbl::gTol 
) const

Checks whether this contour is inside the specified contour.

Parameters
c2dOuter[in] Probable outer contour.
fAllowBordersTouch[in] true to allow the contour to touch and overlap, or false to disallow.
gTol[in] Tolerance.
Returns
true if this contour is located inside the specified countour, false - otherwise.

◆ isOn()

bool FacetModeler::Contour2D::isOn ( const OdGePoint2d ptTest,
double *  pParam = NULL,
const OdGeTol gTol = FMGeGbl::gTol 
) const

Checks whether the 2D point is located on the contour with the given tolerance. If the point is on the contour, the method calculates the parameter value at this point.

Parameters
ptTest[in] Point to check.
pParam[out] (Optional) The contour's resulting parameter at the point ptTest.
gTol[in] Tolerance.
Returns
true if the point lies on the contour with the specified tolerance, or false otherwise.

◆ isSelfIntersecting()

bool FacetModeler::Contour2D::isSelfIntersecting ( const OdGeTol gTol = FMGeGbl::gTol,
bool  bExcludeTouch = false 
) const

Checks whether the contour intersects itself.

Parameters
gTol[in] Tolerance.
bExcludeTouch[in] true for not considering a touch as self-intersection, or false otherwise.
Returns
true if and only if there exists a pair of intersecting segments and the shortest distance along the contour between the intersections is greater than the tolerance, or false otherwise.
Remarks
Runs in O( N * log(N) ) time at the average.

E.g. The method returns true for an 8-shaped contour regardless of the central intersection type (touch or crossing). The method returns false for a O-shaped closed contour, but returns true for an open one.

◆ isValidRegion()

bool FacetModeler::Contour2D::isValidRegion ( const OdGeTol gTol = FMGeGbl::gTol) const

Checks whether this contour is closed and coincides with a directional boundary of an open 2D region.

Parameters
gTol[in] Tolerance.
Returns
false for empty and non-closed contours. false if there are coincident bounds with opposite directions (e.g., O-O shape). false if there are sub-contours with incorrect orientation (e.g., 8 shape). true otherwise.

◆ length()

double FacetModeler::Contour2D::length ( ) const

Gets the length of the contour.

Returns
Contour length.

◆ makeCCW()

void FacetModeler::Contour2D::makeCCW ( bool  bCCW = true)

Makes the contour counter-clockwise or clockwise.

Parameters
bCCW[in] true for counter-clockwise, or false for clockwise.

◆ mergeSegments()

void FacetModeler::Contour2D::mergeSegments ( int  iMergeFlags = 0,
const OdGeTol gTol = FMGeGbl::gTol 
)

Merges adjacent segments.

Parameters
iMergeFlags[in] Combination of AECGe::FilletType flags (emfMergeArcs,emfIgnoreMetadata,emfMergeOrigin).
gTol[in] Tolerance.

◆ metadataAt()

OdIntPtr FacetModeler::Contour2D::metadataAt ( OdUInt32  iIndex) const

Gets metadata for the specified segment.

Parameters
iIndex[in] Segment index.
Returns
Metadata for the specified segment.

◆ nearestParam()

double FacetModeler::Contour2D::nearestParam ( const OdGePoint2d ptTest,
OdGePoint2d ptNearest = NULL 
) const

Gets the nearest parameter and (optional) point on the contour for the given 2D point.

Parameters
ptTest[in] Point to check.
ptNearest[out] (Optional) The nearest point on the contour for the given point ptTest.
Returns
Nearest parameter on contour.

◆ numSegments()

OdUInt32 FacetModeler::Contour2D::numSegments ( ) const

Gets the number of segments.

Returns
Number of segments as OdUInt32.
Remarks
The number of segments is less than or equal (if the contour is closed) to the number of vertices.

◆ numVerts()

OdUInt32 FacetModeler::Contour2D::numVerts ( ) const

Gets the number of vertices.

Returns
Number of vertices as OdUInt32.

◆ operator const IContour2D &()

FacetModeler::Contour2D::operator const IContour2D & ( ) const
inline

Definition at line 1161 of file FMContour2D.h.

◆ operator IContour2D &()

FacetModeler::Contour2D::operator IContour2D & ( )
inline

Definition at line 1163 of file FMContour2D.h.

◆ operator=() [1/2]

Contour2D & FacetModeler::Contour2D::operator= ( const Contour2D rSrcCont)

Creates a copy of the specified contour.

Parameters
rSrcCont[in] Contour to copy.
Returns
Reference to the resulting object.
Remarks
The implementation type remains intact.

◆ operator=() [2/2]

Contour2D & FacetModeler::Contour2D::operator= ( const IContour2D rSrcCont)

Creates a copy of the specified contour implementation to this object.

Parameters
rSrcCont[in] Contour implementation to copy.
Returns
Reference to the resulting object.

◆ orientationAt()

FaceOrientation FacetModeler::Contour2D::orientationAt ( OdUInt32  iIndex) const

Gets the orientation of the segment with the specified index.

Parameters
iIndex[in] Segment index.
Returns
The segment orientation as a FaceOrientation value.

◆ rawFlagsAt()

OdUInt32 FacetModeler::Contour2D::rawFlagsAt ( OdUInt32  iIndex) const

Returns all built-in flags (orientation, visibility etc.) for the specified segment.

Parameters
iIndex[in] Segment index.
Returns
Value of the flags as OdUInt32.
Remarks
By default the flag value is 0.

◆ removeVertexAt()

Result FacetModeler::Contour2D::removeVertexAt ( OdUInt32  iIndex)

Removes a vertex and corresponding segment.

Parameters
iIndex[in] Vertex index.
Returns
eOk if the vertex is removed successfully, or a corresponding result state otherwise.
Remarks
Bulge values of the other segments are left intact.

◆ reserveVertices()

void FacetModeler::Contour2D::reserveVertices ( OdUInt32  iReservedSize)

Sets the capacity of the contour data to the specified vertex number.

Parameters
iReservedSize[in] Vertex number to reserve.

◆ reset()

Contour2D & FacetModeler::Contour2D::reset ( ContourImplClass  eImplClass = ecicUnknown)

Clears the contents of the contour.

Parameters
eImplClass[in] Implementation type.
Returns
Reference to the resulting object.
Remarks
By default the implementation type does not change. The contour is created open.

◆ reverse()

void FacetModeler::Contour2D::reverse ( )

Reverses the contour.

◆ segmentType()

SegmentType FacetModeler::Contour2D::segmentType ( OdUInt32  iIndex) const

Gets the type of segment that begins at the specified vertex.

Parameters
iIndex[in] Segment index.
Returns
Type of the segment: estArc, estLine, estCoincident, or estUnknown if the index is out of range.

◆ setAllMetadata()

Result FacetModeler::Contour2D::setAllMetadata ( OdIntPtr  iNewData,
OdIntPtr  iBitsToModify = (OdIntPtr) -1 
)

Sets metadata for all segments.

Parameters
iNewData[in] New metadata to set.
iBitsToModify[in] A bit mask that indicates which bits to change.
Returns
eOk if the metadata is set successfully, or a corresponding error type otherwise.

◆ setBulgeAt()

Result FacetModeler::Contour2D::setBulgeAt ( OdUInt32  iIndex,
double  dBulge 
)

Sets a bulge value for a vertex with the specified index.

Parameters
iIndex[in] Vertex index.
dBulge[in] Bulge value to set.
Returns
eOk if the bulge is set successfully, or a corresponding error type otherwise.

◆ setClosed()

void FacetModeler::Contour2D::setClosed ( bool  bClosed = true)

Makes the contour closed (or open).

Parameters
bClosed[in] New closed state to set.

◆ setExplodedArcAt()

Result FacetModeler::Contour2D::setExplodedArcAt ( OdUInt32  iIndex,
bool  bExplodedArc = true 
)

Sets or clears the ecfExplodedArc flag at the specified segment.

Parameters
iIndex[in] Segment index.
bExplodedArc[in] New flag value.
Returns
eOk if the segment flag is set successfully, or a corresponding error type otherwise.

◆ setHiddenAt()

Result FacetModeler::Contour2D::setHiddenAt ( OdUInt32  iIndex,
bool  bHidden = true 
)

Sets or clears the ecfHidden flag at the specified segment.

Parameters
iIndex[in] Segment index.
bHidden[in] Hidden state to set.
Returns
eOk if the segment hidden state is set successfully, or a corresponding error type otherwise.

◆ setMetadataAt()

Result FacetModeler::Contour2D::setMetadataAt ( OdUInt32  iIndex,
OdIntPtr  iNewData 
)

Sets metadata for the specified segment.

Parameters
iIndex[in] Segment index.
iNewData[in] New metadata to set.
Returns
eOk if the metadata is set successfully, or a corresponding error type otherwise.
Remarks
By default the metadata value is 0.

◆ setOrientationAt()

Result FacetModeler::Contour2D::setOrientationAt ( OdUInt32  iIndex,
FaceOrientation  eOrientation 
)

Sets the orientation of the segment with the specified index.

Parameters
iIndex[in] Segment index.
eOrientation[in] Orientation state to set.
Returns
eOk if the segment orientation is set successfully, or a corresponding error type otherwise.

◆ setPointAt()

Result FacetModeler::Contour2D::setPointAt ( OdUInt32  iIndex,
const OdGePoint2d ptPoint 
)

Sets a position of a vertex with the specified index.

Parameters
iIndex[in] Vertex index.
ptPoint[in] Vertex point to set.
Returns
eOk if the point is set successfully, or a corresponding error type otherwise.

◆ setRawFlagsAt()

Result FacetModeler::Contour2D::setRawFlagsAt ( OdUInt32  iIndex,
OdUInt32  iRawFlags 
)

Updates all built-in flags (orientation, visibility etc.) for the specified segment.

Parameters
iIndex[in] Vertex index to set.
iRawFlags[in] Raw flags to set as OdUInt32.
Returns
eOk if the flags are set successfully, or a corresponding error type otherwise.

◆ setThreatAsSmoothCurveAt()

void FacetModeler::Contour2D::setThreatAsSmoothCurveAt ( OdUInt32  iIndex,
bool  bSmooth 
)

Sets the "smooth" flag value.

Parameters
iIndex[in] Segment index.
bSmooth[in] New value of the "smooth" flag.
Remarks
The flag is used to create smooth surfaces when generating an extrusion or revolution body.

◆ setVertexAt()

Result FacetModeler::Contour2D::setVertexAt ( OdUInt32  iIndex,
const OdGePoint2d ptPoint,
double  dBulge 
)

Sets a location and a bulge value for a vertex with the specified index.

Parameters
iIndex[in] Vertex index.
ptPoint[in] Vertex point to set.
dBulge[in] Vertex bulge value to set.
Returns
eOk if the location and bulge are set successfully, or a corresponding error type otherwise.

◆ signedArea()

double FacetModeler::Contour2D::signedArea ( ) const

Gets the signed area of the contour.

Returns
Signed area of the contour

◆ startParam()

double FacetModeler::Contour2D::startParam ( ) const
inline

Gets the start contour parameter.

Returns
Start contour parameter value.

Definition at line 779 of file FMContour2D.h.

◆ swap()

void FacetModeler::Contour2D::swap ( Contour2D rAnother)

Swaps the contents of the contour with another one.

Parameters
rAnother[in] Contour to swap.

◆ threatAsSmoothCurveAt()

bool FacetModeler::Contour2D::threatAsSmoothCurveAt ( OdUInt32  iIndex) const

Gets the "smooth" flag value of the segment with the specified index.

Parameters
iIndex[in] Segment index.
Returns
true if the "smooth" flag is set, or false otherwise.
Remarks
The flag is used to create smooth surfaces when generating an extrusion or revolution body.

◆ transformBy()

Result FacetModeler::Contour2D::transformBy ( const OdGeMatrix2d mMatrix,
const DeviationParams devDeviation = FMGeGbl::gDefDev 
)

Transforms the contour.

Parameters
mMatrix[in] Transformation matrix.
devDeviation[in] Deviation parameters.
Returns
eOk if the contour is transformed successfully, or a corresponding error type otherwise.

◆ traverse()

bool FacetModeler::Contour2D::traverse ( Contour2DTraversingReactor reactor) const

Traverses the contour.

Parameters
reactor[in/out] Contour2DTraversingReactor object to traverse.
Returns
false if one of the reactor methods returns false, or true if traversing is successful.

Member Data Documentation

◆ kNull

FMGEOMETRY_API_STATIC const Contour2D FacetModeler::Contour2D::kNull
static

An empty static contour.

Definition at line 1152 of file FMContour2D.h.


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