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

#include <FMSegment2D.h>

Public Member Functions

 Segment2D ()
 
 Segment2D (const OdGePoint2d &ptA, const OdGePoint2d &ptB, double dBulge=0.0, OdIntPtr uMetaData=0, OdUInt32 uRawFlags=0)
 
 Segment2D (const OdGePoint2d &ptA, const OdGePoint2d &ptB, const OdGePoint2d &ptIntermediate)
 
 Segment2D (const Segment2D &rSeg, SegmentImplClass eImplClass=esicBulgeSeg2D)
 
 Segment2D (SegmentImplClass eImplClass)
 
 Segment2D (const IBulgeSeg2D &rSeg, SegmentImplClass eImplClass=esicBulgeSeg2D)
 
Segment2Doperator= (const Segment2D &rSeg)
 
Segment2Doperator= (const IBulgeSeg2D &rSeg)
 
SegmentImplClass implClass () const
 
const OdGePoint2dstartPt () const
 
const OdGePoint2dendPt () const
 
double bulge () const
 
SegmentType type () const
 
double deviation () const
 
void getDir (OdGeVector2d &vDir) const
 
double dirLength () const
 
double length () const
 
Result getLineSeg (OdGeLineSeg2d &rLine) const
 
Result getArcSeg (OdGeCircArc2d &rArc) const
 
Result getPoint (double dParam, OdGePoint2d &ptPoint) const
 
Result getTangent (double dParam, OdGeVector2d &vTangent) const
 
void addExtents (OdGeExtents2d &extExtents, double dTol=0.0) const
 
bool isOn (const OdGePoint2d &ptTest, double *pParam=NULL, const OdGeTol &gTol=FMGeGbl::gTol) const
 
double nearestParam (const OdGePoint2d &ptTest, OdGePoint2d *ptNearest=NULL) const
 
double integrate (const OdGePoint2d &ptOrigin=OdGePoint2d::kOrigin) const
 
Result getSubSegment (double dStartParam, double dEndParam, IBulgeSeg2D &rSubSeg) const
 
Result getParallelSegment (double dNormalOffset, IBulgeSeg2D &rParSeg) const
 
OdUInt32 intersectXRay (const OdGePoint2d &ptTest, bool *pOnSegment=NULL, const OdGeTol &gTol=FMGeGbl::gTol) const
 
OdUInt32 intersect (const IBulgeSeg2D &rSegB, OdGePoint2d *pPt1, OdGePoint2d *pPt2=NULL, const OdGeTol &gTol=FMGeGbl::gTol) const
 
OdUInt32 intersect (const IBulgeSeg2D &rSegB, Intersection *pInt1=NULL, Intersection *pInt2=NULL, const OdGeTol &gTol=FMGeGbl::gTol) const
 
OdUInt32 intersectLine (const OdGeLine2d &rGeLine, Intersection *pInt1=NULL, Intersection *pInt2=NULL, const OdGeTol &gTol=FMGeGbl::gTol) const
 
OdGePoint2d arcCenter () const
 
double arcRadius () const
 
Result getCircleData (OdGePoint2d &ptCenter, double &dRadius) const
 
double arcAngle () const
 
double arcStartAngle () const
 
Result getArcData (OdGePoint2d &ptCenter, double &dRadius, double &dStartAngle, double &dInclAngle) const
 
Result transformBy (const OdGeMatrix2d &mTrans)
 
Result reverse ()
 
Result set (const OdGePoint2d &ptA, const OdGePoint2d &ptB, double dBulge=0.0, OdIntPtr iMetaData=0, OdUInt32 iRawFlags=0)
 
Result set (const OdGePoint2d &ptA, const OdGePoint2d &ptB, const OdGePoint2d &ptIntermediate)
 
Result set (const OdGeLineSeg2d &geLine)
 
Result set (const OdGeCircArc2d &geArc)
 
Result set (const IBulgeSeg2D &rSeg)
 
Result shift (const double dAngle, const double dShiftDist)
 
OdIntPtr metadata () const
 
Result setMetadata (OdIntPtr iNewData)
 
bool isHidden () const
 
Result setHidden (bool bHidden=true)
 
FaceOrientation orientation () const
 
Result setOrientation (FaceOrientation eOrientation)
 
bool isExplodedArc () const
 
Result setExplodedArc (bool bExplodedArc=true)
 
OdUInt32 rawFlags () const
 
Result setRawFlags (OdUInt32 iRawFlags)
 
 ~Segment2D ()
 
 operator const IBulgeSeg2D & () const
 
 operator IBulgeSeg2D & ()
 
const IBulgeSeg2Dimpl () const
 
IBulgeSeg2Dimpl ()
 

Detailed Description

Represents 2D Segment objects.

Remarks
Segment2D is a convex 2D curve given by two points and a bulge value. If the two points coincide, the segment has the estCoincident type. If bulge==0, the segment is a straight line segment; otherwise it is a circular arc, and bulge=tan(Angle/4).

Definition at line 51 of file FMSegment2D.h.

Constructor & Destructor Documentation

◆ Segment2D() [1/6]

FacetModeler::Segment2D::Segment2D ( )

Default constructor.

◆ Segment2D() [2/6]

FacetModeler::Segment2D::Segment2D ( const OdGePoint2d ptA,
const OdGePoint2d ptB,
double  dBulge = 0.0,
OdIntPtr  uMetaData = 0,
OdUInt32  uRawFlags = 0 
)

Constructor. Creates the object with specified start point, end point, bulge, metadata and flags.

Parameters
ptA[in] Start point.
ptB[in] End point.
dBulge[in] (Optional) Bulge value.
uMetaData[in] (Optional) Metadata attribute.
uRawFlags[in] (Optional) Flags as a raw OdUInt32 value.
Remarks
Bulge value = tan(angle/4).

◆ Segment2D() [3/6]

FacetModeler::Segment2D::Segment2D ( const OdGePoint2d ptA,
const OdGePoint2d ptB,
const OdGePoint2d ptIntermediate 
)

Constructor. Creates a segment object using three points.

Parameters
ptA[in] Start point.
ptB[in] End point.
ptIntermediate[in] Intermediate point.

◆ Segment2D() [4/6]

FacetModeler::Segment2D::Segment2D ( const Segment2D rSeg,
SegmentImplClass  eImplClass = esicBulgeSeg2D 
)

Copy constructor. Creates an Segment2D object and initializes it with the given object and with the specified SegmentImplClass type.

Parameters
rSeg[in] Segment2D to copy from.
eImplClass[in] Type of segment implementation.

◆ Segment2D() [5/6]

FacetModeler::Segment2D::Segment2D ( SegmentImplClass  eImplClass)
explicit

Constructor. Creates an object with data from the specified implementation class.

Parameters
eImplClass[in] Implementation object to copy.

◆ Segment2D() [6/6]

FacetModeler::Segment2D::Segment2D ( const IBulgeSeg2D rSeg,
SegmentImplClass  eImplClass = esicBulgeSeg2D 
)
explicit

Copy constructor. Creates an Segment2D object and initializes it with the given implementation object and with the specified SegmentImplClass type.

Parameters
rSeg[in] Implementation object to copy from.
eImplClass[in] Type of segment implementation.

◆ ~Segment2D()

FacetModeler::Segment2D::~Segment2D ( )

Destructor.

Member Function Documentation

◆ addExtents()

void FacetModeler::Segment2D::addExtents ( OdGeExtents2d extExtents,
double  dTol = 0.0 
) const

Adds extents of this segment (extended by dTol) to the given extents.

Parameters
extExtents[out] Extents to add.
dTol[in] Comparing tolerance.

◆ arcAngle()

double FacetModeler::Segment2D::arcAngle ( ) const

Gets the signed included angle of the arc segment.

Returns
Angle value.
Remarks
The returned value belongs in the range (-2*Pi, 2*Pi).

◆ arcCenter()

OdGePoint2d FacetModeler::Segment2D::arcCenter ( ) const

Gets the center of the arc.

Returns
Arc center point as OdGePoint2d.
Remarks
Only works for arc segments.

◆ arcRadius()

double FacetModeler::Segment2D::arcRadius ( ) const

Gets the radius of the arc.

Returns
Radius value.
Remarks
Only works for arc segments.

◆ arcStartAngle()

double FacetModeler::Segment2D::arcStartAngle ( ) const

Gets the start angle of the arc (direction from center to startPt).

Returns
Angle value.
Remarks
The returned value belongs in the range (0, 2*Pi).

◆ bulge()

double FacetModeler::Segment2D::bulge ( ) const

Gets the bulge value of the segment.

Returns
The bulge value.

◆ deviation()

double FacetModeler::Segment2D::deviation ( ) const

Gets the deviation value of the segment.

Returns
The deviation value.

◆ dirLength()

double FacetModeler::Segment2D::dirLength ( ) const

Calculates the distance between the start and end point.

Returns
The distance between the start and end point.

◆ endPt()

const OdGePoint2d & FacetModeler::Segment2D::endPt ( ) const

Gets the end point of the segment as OdGePoint2d.

Returns
The start point.

◆ getArcData()

Result FacetModeler::Segment2D::getArcData ( OdGePoint2d ptCenter,
double &  dRadius,
double &  dStartAngle,
double &  dInclAngle 
) const

Gets the arc center point, radius and angles.

Parameters
ptCenter[out] Center of the circular arc.
dRadius[out] Radius of the circular arc.
dStartAngle[out] Start angle of the circular arc.
dInclAngle[out] End angle of the circular arc.
Returns
eOk if the arc is circular, or a corresponding error type otherwise.

◆ getArcSeg()

Result FacetModeler::Segment2D::getArcSeg ( OdGeCircArc2d rArc) const

Gets the arc segment corresponding to this segment.

Parameters
rArc[out] Resulting circular arc segment.
Returns
eOk if the segment is a circular arc, or erWrongSegType otherwise.
Remarks
Only works for arc segments.

◆ getCircleData()

Result FacetModeler::Segment2D::getCircleData ( OdGePoint2d ptCenter,
double &  dRadius 
) const

Gets the arc radius and center point.

Parameters
ptCenter[out] Center of the circular arc.
dRadius[out] Radius of the circular arc.
Returns
eOk if the arc is circular, or a corresponding error type otherwise.
Remarks
Only works for arc segments.

◆ getDir()

void FacetModeler::Segment2D::getDir ( OdGeVector2d vDir) const

Gets the direction vector of the segment as OdGeVector2d.

Parameters
vDir[out] Direction vector.

◆ getLineSeg()

Result FacetModeler::Segment2D::getLineSeg ( OdGeLineSeg2d rLine) const

Gets the line segment corresponding to this segment.

Parameters
rLine[out] Resulting linear segment.
Returns
eOk if segment is linear, or erWrongSegType otherwise.
Remarks
Only works for line segments.

◆ getParallelSegment()

Result FacetModeler::Segment2D::getParallelSegment ( double  dNormalOffset,
IBulgeSeg2D rParSeg 
) const

Gets the parallel segment.

Parameters
dNormalOffset[in] Normal offset.
rParSeg[out] Resulting segment.
Returns
eOk if the parallel segment calculated successfully, or a corresponding error type otherwise.

◆ getPoint()

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

Gets the point with the specified parameter.

Parameters
dParam[in] Parameter of point on the segment.
ptPoint[out] Point on the segment.
Returns
eOk if the point calculated successfully, or a corresponding error type otherwise.
Remarks
Point parameter in the range [ 0, 1 ].

◆ getSubSegment()

Result FacetModeler::Segment2D::getSubSegment ( double  dStartParam,
double  dEndParam,
IBulgeSeg2D rSubSeg 
) const

Returns the subsegment with two specified parameters.

Parameters
dStartParam[in] Start parameter.
dEndParam[in] End parameter.
rSubSeg[out] Resulting segment.
Returns
eOk if the subsegment calculated successfully, or a corresponding error type otherwise.

◆ getTangent()

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

Gets the tangent vector at the specified parameter.

Parameters
dParam[in] Parameter for calculation.
vTangent[out] Calculated tangent as OdGeVector2d.
Returns
eOk if the tangent calculated successfully, or a corresponding error type otherwise.
Remarks
Point parameter in the range [ 0, 1 ].

◆ impl() [1/2]

IBulgeSeg2D & FacetModeler::Segment2D::impl ( )
inline

Definition at line 583 of file FMSegment2D.h.

◆ impl() [2/2]

const IBulgeSeg2D & FacetModeler::Segment2D::impl ( ) const
inline

Definition at line 582 of file FMSegment2D.h.

◆ implClass()

SegmentImplClass FacetModeler::Segment2D::implClass ( ) const

Gets the segment implementation class of this object.

Returns
Segment implementation class.

◆ integrate()

double FacetModeler::Segment2D::integrate ( const OdGePoint2d ptOrigin = OdGePoint2d::kOrigin) const

Gets the signed area of a contour bounded by this segment and two lines connecting ptOrigin with ends of this segment.

Parameters
ptOrigin[in] Point of origin.
Returns
2 * signed area of a contour bounded by this segment and two lines connecting ptOrigin and the ends of this segment.

◆ intersect() [1/2]

OdUInt32 FacetModeler::Segment2D::intersect ( const IBulgeSeg2D rSegB,
Intersection pInt1 = NULL,
Intersection pInt2 = NULL,
const OdGeTol gTol = FMGeGbl::gTol 
) const

Gets the number of intersections with the specified segment.

Parameters
rSegB[in] Segment to check for intersections with.
pInt1[out] (Optional) First intersection object.
pInt2[out] (Optional) Second intersection object.
gTol[in] Tolerance.
Returns
The number of intersection points.

◆ intersect() [2/2]

OdUInt32 FacetModeler::Segment2D::intersect ( const IBulgeSeg2D rSegB,
OdGePoint2d pPt1,
OdGePoint2d pPt2 = NULL,
const OdGeTol gTol = FMGeGbl::gTol 
) const

Gets the number of intersections with the specified segment.

Parameters
rSegB[in] Segment to check for intersections with.
pPt1[out] (Optional) First intersection point.
pPt2[out] (Optional) Second intersection point.
gTol[in] Tolerance.
Returns
The number of intersection points.

◆ intersectLine()

OdUInt32 FacetModeler::Segment2D::intersectLine ( const OdGeLine2d rGeLine,
Intersection pInt1 = NULL,
Intersection pInt2 = NULL,
const OdGeTol gTol = FMGeGbl::gTol 
) const

Gets the number of intersections with the specified line.

Parameters
rGeLine[in] Line to check for intersections with.
pInt1[out] (Optional) First intersection object.
pInt2[out] (Optional) Second intersection object.
gTol[in] Tolerance.
Returns
The number of intersection points.

◆ intersectXRay()

OdUInt32 FacetModeler::Segment2D::intersectXRay ( const OdGePoint2d ptTest,
bool *  pOnSegment = NULL,
const OdGeTol gTol = FMGeGbl::gTol 
) const

Gets the number of different intersection points of the segment (including end points with minimal Y) with a ray, starting at ptTest and going in the X direction.

Parameters
ptTest[in] Point to test.
pOnSegment[out] The result of checking whether a point lies on the segment.
gTol[in] Tolerance.
Returns
The number of different intersection points.
Remarks
pOnSegment is set to true if the test point lies on the segment.

◆ isExplodedArc()

bool FacetModeler::Segment2D::isExplodedArc ( ) const

Gets the ecfExplodedArc flag value.

Returns
ecfExplodedArc flag value as bool.

◆ isHidden()

bool FacetModeler::Segment2D::isHidden ( ) const

Gets the ecfHidden flag value.

Returns
ecfHidden flag value as bool.

◆ isOn()

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

Checks whether the point lies within a tolerance on the segment.

Parameters
ptTest[in] Point to test.
pParam[out] Resulting parameter.
gTol[in] Tolerance.
Returns
true if the point lies on the segment, or false otherwise.

◆ length()

double FacetModeler::Segment2D::length ( ) const

Returns the segment length.

Calculates the segment length.

Returns
Segment length value.

◆ metadata()

OdIntPtr FacetModeler::Segment2D::metadata ( ) const

Gets metadata.

Returns
Pointer to the metadata object if it exists, or NULL otherwise.

◆ nearestParam()

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

Calculates the nearest parameter to the specified point.

Parameters
ptTest[in] Point to test.
ptNearest[out] Nearest point.
Returns
parameter of a point on the curve that is closest to ptTest.

◆ operator const IBulgeSeg2D &()

FacetModeler::Segment2D::operator const IBulgeSeg2D & ( ) const
inline

Definition at line 580 of file FMSegment2D.h.

◆ operator IBulgeSeg2D &()

FacetModeler::Segment2D::operator IBulgeSeg2D & ( )
inline

Definition at line 581 of file FMSegment2D.h.

◆ operator=() [1/2]

Segment2D & FacetModeler::Segment2D::operator= ( const IBulgeSeg2D rSeg)

Copy operator. Copies data from the specified IBulgeSeg2D object.

Parameters
rSeg[in] Segment implementation to copy.
Returns
Reference to the recomputed segment.

◆ operator=() [2/2]

Segment2D & FacetModeler::Segment2D::operator= ( const Segment2D rSeg)

Copy operator. Copies data from the specified Segment2D object.

Parameters
rSeg[in] Segment to copy.
Returns
Reference to the recomputed segment.

◆ orientation()

FaceOrientation FacetModeler::Segment2D::orientation ( ) const

Gets the orientation of the segment.

Returns
Orientation as a value from the FaceOrientation enum.

◆ rawFlags()

OdUInt32 FacetModeler::Segment2D::rawFlags ( ) const

Gets internal flags (orientation, visibility etc.).

Returns
Internal flags as OdUInt32.

◆ reverse()

Result FacetModeler::Segment2D::reverse ( )

Inverts the segment so it is in the opposite direction.

Returns
eOk if the reversal succeeded, or a corresponding error type otherwise.

◆ set() [1/5]

Result FacetModeler::Segment2D::set ( const IBulgeSeg2D rSeg)

Copies data from another segment.

Parameters
rSeg[in] Segment to copy data from.
Returns
eOk if the update succeeded, or a corresponding error type otherwise.

◆ set() [2/5]

Result FacetModeler::Segment2D::set ( const OdGeCircArc2d geArc)

Copies data from the specified GeCircArc2d and resets metadata.

Parameters
geArc[in] Circular arc segment to copy data from.
Returns
eOk if the update succeeded, or a corresponding error type otherwise.

◆ set() [3/5]

Result FacetModeler::Segment2D::set ( const OdGeLineSeg2d geLine)

Copies data from the specified GeLineSeg2d and resets metadata.

Parameters
geLine[in] Linear segment to copy data from.
Returns
eOk if the update succeeded, or a corresponding error type otherwise.

◆ set() [4/5]

Result FacetModeler::Segment2D::set ( const OdGePoint2d ptA,
const OdGePoint2d ptB,
const OdGePoint2d ptIntermediate 
)

Updates end points and calculates the bulge using the specified intermediate point.

Parameters
ptA[in] Start point.
ptB[in] End point.
ptIntermediate[in] Intermediate point.
Returns
eOk if the update succeeded, or a corresponding error type otherwise.

◆ set() [5/5]

Result FacetModeler::Segment2D::set ( const OdGePoint2d ptA,
const OdGePoint2d ptB,
double  dBulge = 0.0,
OdIntPtr  iMetaData = 0,
OdUInt32  iRawFlags = 0 
)

Updates the object with the specified start point, end point, bulge, metadata and flags.

Parameters
ptA[in] Start point.
ptB[in] End point.
dBulge[in] (Optional) Bulge value.
uMetaData[in] (Optional) Metadata attribute.
uRawFlags[in] (Optional) Flags as raw OdUInt32 value.
Returns
eOk if the update succeeded, or a corresponding error type otherwise.
Remarks
Bulge value = tan(angle/4).

◆ setExplodedArc()

Result FacetModeler::Segment2D::setExplodedArc ( bool  bExplodedArc = true)

Sets or clears the ecfExplodedArc flag.

Parameters
bExplodedArc[in] New value of the ecfExplodedArc flag.
Returns
eOk if the set succeeded, or a corresponding error type otherwise.

◆ setHidden()

Result FacetModeler::Segment2D::setHidden ( bool  bHidden = true)

Sets or clears the ecfHidden flag.

Parameters
bHidden[in] New value of the ecfHidden flag.
Returns
eOk if the set succeeded, or a corresponding error type otherwise.

◆ setMetadata()

Result FacetModeler::Segment2D::setMetadata ( OdIntPtr  iNewData)

Sets metadata.

Parameters
iNewData[in] Pointer to a new metadata object.
Returns
eOk if the set succeeded, or a corresponding error type otherwise.

◆ setOrientation()

Result FacetModeler::Segment2D::setOrientation ( FaceOrientation  eOrientation)

Sets the orientation of the segment.

Parameters
eOrientation[in] New orientation value.
Returns
eOk if the set succeeded, or a corresponding error type otherwise.

◆ setRawFlags()

Result FacetModeler::Segment2D::setRawFlags ( OdUInt32  iRawFlags)

Sets internal flags (orientation, visibility etc.).

Parameters
iRawFlags[in] New value of internal flags to set.
Returns
eOk if the set succeeded, or a corresponding error type otherwise.

◆ shift()

Result FacetModeler::Segment2D::shift ( const double  dAngle,
const double  dShiftDist 
)

Shifts the segment in the direction specified by the angle and distance.

Parameters
dAngle[in] Shear direction angle.
dShiftDist[in] Shear distance.
Returns
eOk if the shift succeeded, or a corresponding error type otherwise.

◆ startPt()

const OdGePoint2d & FacetModeler::Segment2D::startPt ( ) const

Gets the start point of the segment as OdGePoint2d.

Returns
The start point.

◆ transformBy()

Result FacetModeler::Segment2D::transformBy ( const OdGeMatrix2d mTrans)

Transforms the segment using the specified matrix.

Parameters
mTrans[in] Transformation matrix.
Returns
eOk if the transformation succeeded, or a corresponding error type otherwise.

◆ type()

SegmentType FacetModeler::Segment2D::type ( ) const

Gets the segment type of this object.

Returns
Segment type.

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