CFx SDK Documentation 2024 SP0
Loading...
Searching...
No Matches
FMContour2D.h
Go to the documentation of this file.
1
2// Copyright (C) 2002-2022, Open Design Alliance (the "Alliance").
3// All rights reserved.
4//
5// This software and its documentation and related materials are owned by
6// the Alliance. The software may only be incorporated into application
7// programs owned by members of the Alliance, subject to a signed
8// Membership Agreement and Supplemental Software License Agreement with the
9// Alliance. The structure and organization of this software are the valuable
10// trade secrets of the Alliance and its suppliers. The software is also
11// protected by copyright law and international treaty provisions. Application
12// programs incorporating this software must include the following statement
13// with their copyright notices:
14//
15// This application incorporates Open Design Alliance software pursuant to a license
16// agreement with Open Design Alliance.
17// Open Design Alliance Copyright (C) 2002-2022 by Open Design Alliance.
18// All rights reserved.
19//
20// By use of this software, its documentation or related materials, you
21// acknowledge and accept the above terms.
23
24#ifndef __FMCONTOUR2D_H__
25#define __FMCONTOUR2D_H__
26
27#include "FMGeometry.h"
28#include "FMContoursBase.h"
29#include "FMSegment2D.h"
30
31namespace FacetModeler
32{
33
34 class IContour2D;
35 class IBulgeSeg2D;
36 class Profile2D;
37
45 public:
52 virtual bool onLineSeg(int nSegment) = 0;
53
61 virtual bool onArcSeg(int nSegment, DeviationParams** ppDev) = 0;
62
71 virtual bool onArcStartPoint(int nSegment, const OdGePoint2d& pt, int nTotalPts) = 0;
72
80 virtual bool onArcPoint(int nSegment, const OdGePoint2d& pt) = 0;
81
89 virtual bool onArcEndPoint(int nSegment, const OdGePoint2d& pt) = 0;
90
97 virtual bool onCoincidentSeg(int nSegment) = 0;
98 };
99
119 {
120 public:
125
131 explicit Contour2D(ContourImplClass eImplClass);
132
139 explicit Contour2D(const IBulgeSeg2D& rSrcSeg,
140 ContourImplClass eImplClass = ecicSimple);
141
148 Contour2D(const Contour2D& rSrcCont,
149 ContourImplClass eImplClass = ecicSimple);
150
157 explicit Contour2D(const IContour2D& rSrcCont,
158 ContourImplClass eImplClass = ecicSimple);
159
166
176 Contour2D& operator = (const Contour2D& rSrcCont);
177
184 Contour2D& operator = (const IContour2D& rSrcCont);
185
195 Contour2D& cloneFrom(const IContour2D& rSrcCont);
196
207 Contour2D& reset(ContourImplClass eImplClass = ecicUnknown);
208
215
221 void swap(Contour2D& rAnother);
222
228 bool isClosed() const;
229
236 bool isEndsEqual(const OdGeTol& gTol = FMGeGbl::gTol) const;
237
243 void setClosed(bool bClosed = true);
244
250 bool isEmpty() const;
251
258
268
274 bool hasArcs() const;
275
283
292 Segment2D& rSegment) const;
293
304 OdGePoint2d& ptStart,
305 OdGePoint2d& ptEnd,
306 double& dBulge) const;
307
316 OdGeLineSeg2d& geLine) const;
317
326 OdGeCircArc2d& geArc) const;
327
336 OdGePoint2d& ptPoint) const;
337
346 double& dBulge) const;
347
359 OdGePoint2d* pPoint, double* pBulge = NULL,
360 OdIntPtr* pMetadata = NULL, OdUInt32* puRawFlags = NULL) const;
361
369 Result getInternalAngleAt(OdUInt32 iIndex, double & dAngle) const;
370
379 const OdGePoint2d& ptPoint);
380
389 double dBulge);
390
400 const OdGePoint2d& ptPoint, double dBulge);
401
407 void reserveVertices(OdUInt32 iReservedSize);
408
416
428 OdIntPtr iNewData);
429
438 OdIntPtr iBitsToModify = (OdIntPtr)-1);
439
446 bool isHiddenAt(OdUInt32 iIndex) const;
447
456 bool bHidden = true);
457
465
474 FaceOrientation eOrientation);
475
485 bool threatAsSmoothCurveAt(OdUInt32 iIndex) const;
486
496 void setThreatAsSmoothCurveAt(OdUInt32 iIndex, bool bSmooth);
497
504 bool isExplodedArcAt(OdUInt32 iIndex) const;
505
514 bool bExplodedArc = true);
515
526
535
550 const OdGePoint2d& ptStart, double dBulge = 0.0,
551 OdIntPtr uMetadata = 0, OdUInt32 uRawFlags = 0);
552
565 Result appendVertex(const OdGePoint2d& ptStart, double dBulge = 0.0,
566 OdIntPtr uMetadata = 0, OdUInt32 uRawFlags = 0);
567
578 const OdGePoint2d& ptMid, OdIntPtr uMetadata = 0, OdUInt32 uRawFlags = 0);
579
587
596 Result appendVertices(OdUInt32 size, const OdGePoint2d* vecSource, const double* bulgeSource = NULL);
597
609 bool bShiftToHit = false);
610
624 bool bCloseGap = false, double dMaxGap = 1e99);
625
636
647
658
666 Result getTangent(double dParam,
667 OdGeVector2d& vTangent) const;
668
677 OdGeVector2d& vTangent) const;
678
686 Result getPoint(double dParam,
687 OdGePoint2d& ptPoint) const;
688
696 Result getPointAtDist(double dDist,
697 OdGePoint2d& ptPoint) const;
698
706 Result getDistAtParam(double dParam,
707 double& dDist) const;
708
716 Result getParamAtDist(double dDist,
717 double& dParam) const;
718
728 Result getNormalizedParam(double& dParam) const;
729
739 Result getNormalizedDist(double& dDist) const;
740
749 bool areEqualParams(double dParam1,
750 double dParam2, double dParamTol = 1e-10) const;
751
763 bool areEqualDists(double dDist1,
764 double dDist2, double dTol = 1e-6/*FMGeGbl::gTol.equalPoint()*/) const;
765
772 Result addExtents(OdGeExtents2d& extExtents) const;
773
779 inline double startParam() const { return 0.0; };
780
786 double endParam() const;
787
788 // Returns true and a period value, if the contour is closed
789 // Returns false otherwise
790 //bool getPeriodParam( double & dPeriod ) const;
791
797 double length() const;
798
808 double area() const;
809
815 double signedArea() const;
816
822 bool isConvex() const;
823
833 bool isCCW() const;
834
840 void makeCCW(bool bCCW = true);
841
852 bool isOn(const OdGePoint2d& ptTest, double* pParam = NULL,
853 const OdGeTol& gTol = FMGeGbl::gTol) const;
854
863 double nearestParam(const OdGePoint2d& ptTest,
864 OdGePoint2d* ptNearest = NULL) const;
865
875 bool contains(const OdGePoint2d& ptPoint, bool* pOnBorder = NULL,
876 const OdGeTol& gTol = FMGeGbl::gTol) const;
877
897 bool isSelfIntersecting(const OdGeTol& gTol = FMGeGbl::gTol, bool bExcludeTouch = false) const;
898
910 bool isValidRegion(const OdGeTol& gTol = FMGeGbl::gTol) const;
911
920 bool isInsideContour(const Contour2D& c2dOuter,
921 bool fAllowBordersTouch = false,
922 const OdGeTol& gTol = FMGeGbl::gTol) const;
923
934 std::vector< Intersection >& vecPoints,
935 const OdGeTol& gTol = FMGeGbl::gTol) const;
936
947 std::vector< Intersection >& vecPoints,
948 const OdGeTol& gTol = FMGeGbl::gTol) const;
949
959 std::vector< Intersection >& vecPoints,
960 const OdGeTol& gTol = FMGeGbl::gTol) const;
961
970 const DeviationParams& devDeviation = FMGeGbl::gDefDev);
971
975 void reverse();
976
982 void deleteCoincident(const OdGeTol& gTol = FMGeGbl::gTol);
983
990 void mergeSegments(int iMergeFlags = 0, const OdGeTol & gTol = FMGeGbl::gTol);
991
1000 Result explode(const DeviationParams& devDeviation = FMGeGbl::gDefDev, OdIntPtr uArcMetadata = 0);
1001
1012 const DeviationParams& devDeviation = FMGeGbl::gDefDev, OdIntPtr uArcMetadata = 0) const;
1013
1027 const OdGeTol& gTol = FMGeGbl::gTol);
1028
1041 const OdGeTol & gTol = FMGeGbl::gTol);
1042
1053 Result createVerticesAt(const std::vector<double> & vecParams,
1054 const OdGeTol& gTol = FMGeGbl::gTol);
1055
1067 Result createVerticesAt(OdUInt32 size, const double* vecParams,
1068 const OdGeTol& gTol = FMGeGbl::gTol);
1069
1082 Result getSubContour(double dStartParam, double dEndParam,
1083 Contour2D & rSubContour, const OdGeTol & gTol = FMGeGbl::gTol) const;
1084
1097 Result getOffsetProfile(double dOffset, Profile2D& rResult,
1098 FilletType eFilletType = eftExtend,
1099 const OdGeTol& gTol = FMGeGbl::gTol) const;
1100
1112 Result getProfileByOffsets(const std::vector< double >& adOffset,
1113 Profile2D& rResult,
1114 const OdGeTol& gTol = FMGeGbl::gTol) const;
1115
1123
1130
1138 static Contour2D createCircle(const OdGePoint2d &center, double radius);
1139
1147 static Contour2D createSquare(const OdGePoint2d &center, double side);
1148
1153
1158
1159 public:
1160 //DOM-IGNORE-BEGIN
1161 inline operator const IContour2D& () const { return *m_pImpl; }
1162
1163 inline operator IContour2D& () { return *m_pImpl; }
1164
1165 inline const IContour2D & impl() const { return *m_pImpl; }
1166
1167 inline IContour2D & impl() { return *m_pImpl; }
1168 //DOM-IGNORE-END
1169 private:
1170 IContour2D* m_pImpl; // Pointer to the implementation object.
1171 };
1172
1173};
1174
1175#endif //__FMCONTOUR2D_H__
#define FMGEOMETRY_API
#define FMGEOMETRY_API_STATIC
unsigned int OdUInt32
#define ODRX_ABSTRACT
ptrdiff_t OdIntPtr
Result setAllMetadata(OdIntPtr iNewData, OdIntPtr iBitsToModify=(OdIntPtr) -1)
void swap(Contour2D &rAnother)
OdIntPtr metadataAt(OdUInt32 iIndex) const
Contour2D & reset(ContourImplClass eImplClass=ecicUnknown)
Contour2D(const Contour2D &rSrcCont, ContourImplClass eImplClass=ecicSimple)
Contour2D(const IBulgeSeg2D &rSrcSeg, ContourImplClass eImplClass=ecicSimple)
Result explodeTo(Contour2D &rDestCont, const DeviationParams &devDeviation=FMGeGbl::gDefDev, OdIntPtr uArcMetadata=0) const
void deleteCoincident(const OdGeTol &gTol=FMGeGbl::gTol)
double length() const
Result setMetadataAt(OdUInt32 iIndex, OdIntPtr iNewData)
OdUInt32 intersectLine(const OdGeLine2d &rLine, std::vector< Intersection > &vecPoints, const OdGeTol &gTol=FMGeGbl::gTol) const
Result createVerticesAt(const std::vector< double > &vecParams, const OdGeTol &gTol=FMGeGbl::gTol)
Result getLineSegAt(OdUInt32 iIndex, OdGeLineSeg2d &geLine) const
Contour2D(const IContour2D &rSrcCont, ContourImplClass eImplClass=ecicSimple)
double startParam() const
Definition: FMContour2D.h:779
bool isHiddenAt(OdUInt32 iIndex) const
double nearestParam(const OdGePoint2d &ptTest, OdGePoint2d *ptNearest=NULL) const
OdUInt32 intersect(const Segment2D &rSegB, std::vector< Intersection > &vecPoints, const OdGeTol &gTol=FMGeGbl::gTol) const
OdUInt32 rawFlagsAt(OdUInt32 iIndex) const
OdUInt32 createVertexAtDist(double dDist, const OdGeTol &gTol=FMGeGbl::gTol)
double endParam() const
bool threatAsSmoothCurveAt(OdUInt32 iIndex) const
Result appendContour(const Contour2D &rCont, bool bCloseGap=false, double dMaxGap=1e99)
bool isInsideContour(const Contour2D &c2dOuter, bool fAllowBordersTouch=false, const OdGeTol &gTol=FMGeGbl::gTol) const
OdUInt32 intersect(const Contour2D &rContB, std::vector< Intersection > &vecPoints, const OdGeTol &gTol=FMGeGbl::gTol) const
bool contains(const OdGePoint2d &ptPoint, bool *pOnBorder=NULL, const OdGeTol &gTol=FMGeGbl::gTol) const
Result getVertexAt(OdUInt32 iIndex, OdGePoint2d *pPoint, double *pBulge=NULL, OdIntPtr *pMetadata=NULL, OdUInt32 *puRawFlags=NULL) const
const IContour2D & impl() const
Definition: FMContour2D.h:1165
Result transformBy(const OdGeMatrix2d &mMatrix, const DeviationParams &devDeviation=FMGeGbl::gDefDev)
Result getProfileByOffsets(const std::vector< double > &adOffset, Profile2D &rResult, const OdGeTol &gTol=FMGeGbl::gTol) const
Contour2D(const OdGeExtents2d &ext)
void reserveVertices(OdUInt32 iReservedSize)
Result appendSegment(const Segment2D &rSeg, bool bShiftToHit=false)
Result getBulgeAt(OdUInt32 iIndex, double &dBulge) const
void setClosed(bool bClosed=true)
Result getArcSegAt(OdUInt32 iIndex, OdGeCircArc2d &geArc) const
FaceOrientation orientationAt(OdUInt32 iIndex) const
OdUInt32 numVerts() const
SegmentType segmentType(OdUInt32 iIndex) const
Result getSegmentAt(OdUInt32 iIndex, OdGePoint2d &ptStart, OdGePoint2d &ptEnd, double &dBulge) const
Contour2D(ContourImplClass eImplClass)
Result appendVertices(OdUInt32 size, const OdGePoint2d *vecSource, const double *bulgeSource=NULL)
Result setHiddenAt(OdUInt32 iIndex, bool bHidden=true)
Result setVertexAt(OdUInt32 iIndex, const OdGePoint2d &ptPoint, double dBulge)
Result setRawFlagsAt(OdUInt32 iIndex, OdUInt32 iRawFlags)
Result appendVertices(const OdGePoint2dArray &vecSource)
static Contour2D createCircle(const OdGePoint2d &center, double radius)
bool isExplodedArcAt(OdUInt32 iIndex) const
bool areEqualParams(double dParam1, double dParam2, double dParamTol=1e-10) const
bool traverse(Contour2DTraversingReactor &reactor) const
ContourImplClass implClass() const
Result setPointAt(OdUInt32 iIndex, const OdGePoint2d &ptPoint)
bool isSelfIntersecting(const OdGeTol &gTol=FMGeGbl::gTol, bool bExcludeTouch=false) const
bool isOn(const OdGePoint2d &ptTest, double *pParam=NULL, const OdGeTol &gTol=FMGeGbl::gTol) const
Result addExtents(OdGeExtents2d &extExtents) const
Result getParamAtDist(double dDist, double &dParam) const
static Contour2D createSquare(const OdGePoint2d &center, double side)
Result getPointAt(OdUInt32 iIndex, OdGePoint2d &ptPoint) const
Contour2D & cloneFrom(const IContour2D &rSrcCont)
Result explode(const DeviationParams &devDeviation=FMGeGbl::gDefDev, OdIntPtr uArcMetadata=0)
Result getTangentAtDist(double dDist, OdGeVector2d &vTangent) const
Result getStartPoint(OdGePoint2d &ptPoint) const
Result getTangent(double dParam, OdGeVector2d &vTangent) const
Result setExplodedArcAt(OdUInt32 iIndex, bool bExplodedArc=true)
Result getOffsetProfile(double dOffset, Profile2D &rResult, FilletType eFilletType=eftExtend, const OdGeTol &gTol=FMGeGbl::gTol) const
Result getSegmentAt(OdUInt32 iIndex, Segment2D &rSegment) const
Result setOrientationAt(OdUInt32 iIndex, FaceOrientation eOrientation)
Result getNormalizedParam(double &dParam) const
void makeCCW(bool bCCW=true)
Result addVertexAt(OdUInt32 iIndex, const OdGePoint2d &ptStart, double dBulge=0.0, OdIntPtr uMetadata=0, OdUInt32 uRawFlags=0)
Result removeVertexAt(OdUInt32 iIndex)
Result appendVertex(const OdGePoint2d &ptStart, const OdGePoint2d &ptMid, OdIntPtr uMetadata=0, OdUInt32 uRawFlags=0)
bool isValidRegion(const OdGeTol &gTol=FMGeGbl::gTol) const
Result getEndPoint(OdGePoint2d &ptPoint) const
OdUInt32 numSegments() const
void mergeSegments(int iMergeFlags=0, const OdGeTol &gTol=FMGeGbl::gTol)
static FMGEOMETRY_API_STATIC const Contour2D kNull
Definition: FMContour2D.h:1152
bool areEqualDists(double dDist1, double dDist2, double dTol=1e-6) const
OdUInt32 createVertexAt(double dParam, const OdGeTol &gTol=FMGeGbl::gTol)
Result getPoint(double dParam, OdGePoint2d &ptPoint) const
Result getDistAtParam(double dParam, double &dDist) const
void setThreatAsSmoothCurveAt(OdUInt32 iIndex, bool bSmooth)
bool isEndsEqual(const OdGeTol &gTol=FMGeGbl::gTol) const
Result getInternalAngleAt(OdUInt32 iIndex, double &dAngle) const
double signedArea() const
Result getNormalizedDist(double &dDist) const
Result getPointAtDist(double dDist, OdGePoint2d &ptPoint) const
Result createVerticesAt(OdUInt32 size, const double *vecParams, const OdGeTol &gTol=FMGeGbl::gTol)
Result appendVertex(const OdGePoint2d &ptStart, double dBulge=0.0, OdIntPtr uMetadata=0, OdUInt32 uRawFlags=0)
Result getSubContour(double dStartParam, double dEndParam, Contour2D &rSubContour, const OdGeTol &gTol=FMGeGbl::gTol) const
Result setBulgeAt(OdUInt32 iIndex, double dBulge)
void getGeomExtens(OdGeExtents2d &extens)
virtual bool onArcEndPoint(int nSegment, const OdGePoint2d &pt)=0
virtual bool onArcStartPoint(int nSegment, const OdGePoint2d &pt, int nTotalPts)=0
virtual bool onCoincidentSeg(int nSegment)=0
virtual bool onArcSeg(int nSegment, DeviationParams **ppDev)=0
virtual bool onLineSeg(int nSegment)=0
virtual bool onArcPoint(int nSegment, const OdGePoint2d &pt)=0
Definition: GeTol.h:49
GLsizeiptr size
Definition: gles2_ext.h:182