CFx SDK Documentation 2024 SP0
Loading...
Searching...
No Matches
GeTess.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 __ODGITESSELATOR_H_INCLUDED__
25#define __ODGITESSELATOR_H_INCLUDED__
26
27
28#include "RxObject.h"
29#include "Ge/GePoint2d.h"
30#include "Ge/GePoint3d.h"
31#include "Ge/GeVector2d.h"
32
33#include "TD_PackPush.h"
34
35#ifndef ODGT_NAMESPACE
36 #define ODGT_NAMESPACE OdGeTess
37 #define ODGT_PTRTYPE OdSmartPtr<Contour>
38 #define ODGT_PARENT : public OdRxObject
39 #define ODGT_MEMBERS
40 #define ODGT_HOLDER
41 #define ODGT_HOLDER2
42 #define ODGT_MEMBERS2
43#endif
44
50{
51
53{
58};
59
60
62{
66};
67
68class Vertex;
69
71{
73 double u1;
74 bool operator < (const Intersection& op) const { return u1 < op.u1; }
75 bool operator < (double op) const { return u1 < op; }
76};
77
79
80class Contour;
81class LocalVert;
83
85{
86 friend class Vertex;
88protected:
91
92 const void *m_pCoords;
93
94 unsigned m_b2d:1;
95 unsigned m_bClockwise:1;
96 unsigned m_bFailed:1;
97 unsigned m_bInvalidHoles : 1;
98 double m_tol;
99
100 void addVertex(Vertex* vertex);
101 void removeVertex(Vertex* vertex);
102 void delVertex(Vertex* vertex);
103 void breakContour(Vertex* vertex);
104 bool normalize(double size, double tol);
105 void checkClockwiseOriented(int bNested, double tol);
106 static void split(Vertex* v1, Vertex* v2);
107 bool isInside(const OdGePoint2d& point) const;
108 static bool isIncommingR(const Vertex* v1, const Vertex* v2);
109 void concatContours(Vertex* pC1vert, Contour* pContour2, Vertex* pC2vert);
112 void splitPolygon(Vertex* pV1, Vertex* pV2);
113
114 void breakToConvex2(double size);
115 double calcMaxCoordValue(double& size) const;
117 double squareTolerance(double eps = 0, bool forAccurately = false) const;
118protected:
120public:
122
123 static ContourPtr create(const void* coords, bool b2d ODGT_HOLDER);
124 static ContourPtr create(const OdGePoint2d* coords ODGT_HOLDER) { return create(coords, true ODGT_HOLDER2); }
125 static ContourPtr create(const OdGePoint3d* coords ODGT_HOLDER) { return create(coords, false ODGT_HOLDER2); }
126 ContourPtr insert(Contour* pCntr2Ins)
127 {
128 ODA_ASSERT(pCntr2Ins!=this);
129 pCntr2Ins->m_pNextContour = m_pNextContour;
130 return (m_pNextContour = pCntr2Ins);
131 }
132 Vertex* addVertex(int index, unsigned int edgeId = 0);
140 ContourPtr breakToConvex(unsigned int options, double eps = 0);
141 void inverse();
142
143 const Vertex* head() const { return m_pFirstVertex; }
144 Vertex* head() { return m_pFirstVertex; }
145 bool vectorIntersects(const Vertex* v1, const Vertex* v2, bool bNested) const;
146 static bool isIncomming(const Vertex* v1, const Vertex* v2);
155 double squareValue(double* tol = NULL, double eps = 0, bool isAccurately = false) const;
156 ContourPtr copy(int bNested) const;
157 bool isIncommingOrOnEdgeR(const Vertex* pV1, const Vertex* pV2) const;
158 const OdGePoint2d& point(int index) const
159 {
160 if(m_b2d)
161 return reinterpret_cast<const OdGePoint2d*>(m_pCoords)[index];
162 return *reinterpret_cast<const OdGePoint2d*>(reinterpret_cast<const OdGePoint3d*>(m_pCoords) + index);
163 }
164 ContourPtr next() const { return m_pNextContour; }
165
166 const void* coords() const { return m_pCoords; }
167 bool is2d() const { return m_b2d; }
168 bool isTriangle() const;
169 bool isLineSeg() const;
170 bool intersections(const Vertex* vert1, const Vertex* vert2, Intersections& res, bool bNested) const;
171 bool intersections_lv(const Vertex* vert1, const LocalVert* vert2, Intersections& res, bool bNested) const;
172 //FELIX_CHANGE_BEGIN
173 bool intersections(const Vertex* pVert1, const OdGePoint2d* pVert2, Intersections& res, bool bNested) const;
174 //FELIX_CHANGE_END
175 bool failed() const { return m_bFailed; }
181 bool hasInvalidHoles() const { return m_bInvalidHoles; }
182 double tol() const { return m_tol; }
183};
184
185
187{
188 friend class Contour;
189 Contour *m_pContour;
190
192
193protected:
197 unsigned int m_nEdgeId;
198
199public:
201 : m_pContour(0)
202 , m_pNextVertex(0)
203 , m_pPrevVertex(0)
204 , m_nIndex(0)
205 , m_nEdgeId(0)
206 {
207 }
208 void link(Vertex* vert2)
209 {
210 m_pNextVertex = vert2;
211 vert2->m_pPrevVertex = this;
212 }
213 const Vertex* next() const { return m_pNextVertex; }
214 Vertex* next() { return m_pNextVertex; }
215 const Vertex* prev() const { return m_pPrevVertex; }
216 Vertex* prev() { return m_pPrevVertex; }
217 int index() const { return m_nIndex; }
218 void setIndex(int nIndex) { m_nIndex = nIndex; }
219 unsigned int edgeId() const { return m_nEdgeId; }
220 void setEdgeId(unsigned int nEdgeId) { m_nEdgeId = nEdgeId; }
221
222 const OdGePoint2d& point() const { return m_pContour->point(m_nIndex); }
223
225
226 ContourPtr contour() const { return m_pContour; }
227 void setContour(Contour* pContour) { m_pContour = pContour; }
228
229};
230
231inline bool Contour::isTriangle() const
232{
233 return (m_pFirstVertex && m_pFirstVertex->next()->next()==m_pFirstVertex->prev());
234}
235
236inline bool Contour::isLineSeg() const
237{
238 return (m_pFirstVertex && m_pFirstVertex->next()==m_pFirstVertex->prev());
239}
240
241
242} //namespace
243
244#include "TD_PackPop.h"
245
246#undef ODGT_NAMESPACE
247#undef ODGT_PTRTYPE
248#undef ODGT_PARENT
249#undef ODGT_MEMBERS
250#undef ODGT_HOLDER
251#undef ODGT_HOLDER2
252#undef ODGT_MEMBERS2
253
254#endif // __ODGITESSELATOR_H_INCLUDED__
#define ODA_ASSERT(exp)
Definition: DebugStuff.h:57
tol
Definition: DimVarDefs.h:2287
#define GE_TOOLKIT_EXPORT
Definition: GeExport.h:49
#define ODGT_HOLDER2
Definition: GeTess.h:41
#define ODGT_HOLDER
Definition: GeTess.h:40
#define ODGT_MEMBERS2
Definition: GeTess.h:42
#define ODGT_MEMBERS
Definition: GeTess.h:39
#define ODGT_PTRTYPE
Definition: GeTess.h:37
const Vertex * head() const
Definition: GeTess.h:143
ContourPtr next() const
Definition: GeTess.h:164
static bool isIncomming(const Vertex *v1, const Vertex *v2)
const OdGePoint2d & point(int index) const
Definition: GeTess.h:158
const void * m_pCoords
Definition: GeTess.h:92
double squareTolerance(double eps=0, bool forAccurately=false) const
double tol() const
Definition: GeTess.h:182
Vertex * addVertex(int index, unsigned int edgeId=0)
void breakContour(Vertex *vertex)
static ContourPtr create(const OdGePoint2d *coords ODGT_HOLDER)
Definition: GeTess.h:124
ContourPtr copy(int bNested) const
static ContourPtr create(const OdGePoint3d *coords ODGT_HOLDER)
Definition: GeTess.h:125
bool isInside(const OdGePoint2d &point) const
ContourPtr breakToConvex(unsigned int options, double eps=0)
ContourPtr m_pNextContour
Definition: GeTess.h:90
bool normalize(double size, double tol)
bool intersections(const Vertex *pVert1, const OdGePoint2d *pVert2, Intersections &res, bool bNested) const
double squareValue(double *tol=NULL, double eps=0, bool isAccurately=false) const
bool vectorIntersects(const Vertex *v1, const Vertex *v2, bool bNested) const
void checkClockwiseOriented(int bNested, double tol)
static bool isIncommingR(const Vertex *v1, const Vertex *v2)
ContourPtr insert(Contour *pCntr2Ins)
Definition: GeTess.h:126
static ContourPtr create(const void *coords, bool b2d ODGT_HOLDER)
bool isIncommingOrOnEdgeR(const Vertex *pV1, const Vertex *pV2) const
static void split(Vertex *v1, Vertex *v2)
bool hasInvalidHoles() const
Definition: GeTess.h:181
void addVertex(Vertex *vertex)
void breakToConvex2(double size)
const void * coords() const
Definition: GeTess.h:166
void splitPolygon(Vertex *pV1, Vertex *pV2)
double calcMaxCoordValue(double &size) const
bool intersections(const Vertex *vert1, const Vertex *vert2, Intersections &res, bool bNested) const
void delVertex(Vertex *vertex)
ContourPtr lastContour() const
void concatContours(Vertex *pC1vert, Contour *pContour2, Vertex *pC2vert)
void removeEqualVertexes(const OdGeTol &tol)
bool splitOnCoincidentPoint(double size)
void removeVertex(Vertex *vertex)
bool intersections_lv(const Vertex *vert1, const LocalVert *vert2, Intersections &res, bool bNested) const
void setContour(Contour *pContour)
Definition: GeTess.h:227
const Vertex * next() const
Definition: GeTess.h:213
Vertex * m_pPrevVertex
Definition: GeTess.h:195
const OdGePoint2d & point() const
Definition: GeTess.h:222
unsigned int m_nEdgeId
Definition: GeTess.h:197
void setIndex(int nIndex)
Definition: GeTess.h:218
void setEdgeId(unsigned int nEdgeId)
Definition: GeTess.h:220
int index() const
Definition: GeTess.h:217
void link(Vertex *vert2)
Definition: GeTess.h:208
ContourPtr contour() const
Definition: GeTess.h:226
Vertex * prev()
Definition: GeTess.h:216
EdgesType edgesType() const
Vertex * m_pNextVertex
Definition: GeTess.h:194
const Vertex * prev() const
Definition: GeTess.h:215
Vertex * next()
Definition: GeTess.h:214
unsigned int edgeId() const
Definition: GeTess.h:219
Definition: GeTol.h:49
GLfloat GLfloat v1
Definition: gles2_ext.h:295
GLfloat GLfloat GLfloat v2
Definition: gles2_ext.h:296
GLsizeiptr size
Definition: gles2_ext.h:182
GLuint index
Definition: gles2_ext.h:265
ODGT_PTRTYPE ContourPtr
Definition: GeTess.h:82
@ kBrCopyResult
Definition: GeTess.h:63
@ kBrDetectHoles
Definition: GeTess.h:64
@ kBrNormalized
Definition: GeTess.h:65
bool operator<(const Intersection &op) const
Definition: GeTess.h:74