Fade2.5D Documentation pages v1.90
Delaunay Features
ConstraintGraph2.h
Go to the documentation of this file.
1 // Copyright (C) Geom Software e.U, Bernhard Kornberger, Graz/Austria
2 //
3 // This file is part of the Fade2D library. The student license is free
4 // of charge and covers personal non-commercial research. Licensees
5 // holding a commercial license may use this file in accordance with
6 // the Commercial License Agreement.
7 //
8 // This software is provided AS IS with NO WARRANTY OF ANY KIND,
9 // INCLUDING THE WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS
10 // FOR A PARTICULAR PURPOSE.
11 //
12 // Please contact the author if any conditions of this licensing are
13 // not clear to you.
14 //
15 // Author: Bernhard Kornberger, bkorn (at) geom.at
16 // http://www.geom.at
17 
19 
20 #pragma once
21 #include "Segment2.h"
22 #include "ConstraintSegment2.h"
23 #include "Edge2.h"
24 #include <map>
25 
26 
27 #include "common.h"
28 #if GEOM_PSEUDO3D==GEOM_TRUE
29  namespace GEOM_FADE25D {
30 #elif GEOM_PSEUDO3D==GEOM_FALSE
31  namespace GEOM_FADE2D {
32 #else
33  #error GEOM_PSEUDO3D is not defined
34 #endif
35 
36 // FWD
37 class Dt2;
38 class ConstraintSegment2;
39 class GeomTest;
40 class Visualizer2;
41 class Color;
42 
52 {
53 public:
55  CLASS_DECLSPEC
57  Dt2* pDt2_,
58  std::vector<ConstraintSegment2*>& vCSegments,
60  );
61 
63  CLASS_DECLSPEC
65  Dt2* pDt2_,
66  std::vector<ConstraintSegment2*>& vCSegments_,
67  std::map<std::pair<Point2*,Point2*>,bool > mPPReverse,
69  );
70 
72  void init(std::vector<ConstraintSegment2*>& vCSegments_);
73 
74 
75 
83  CLASS_DECLSPEC
84  bool isPolygon() const;
85 
92  CLASS_DECLSPEC
93  bool isOriented() const;
94 
110  CLASS_DECLSPEC
111  void getPolygonVertices(std::vector<Point2*>& vVertices_) ;
112 
113 
124  CLASS_DECLSPEC
126 
132  CLASS_DECLSPEC
133  bool isConstraint(Point2* p0,Point2* p1) const;
134 
143  CLASS_DECLSPEC
144  bool isConstraint(ConstraintSegment2* pCSeg) const;
145 
146 
150  CLASS_DECLSPEC
151  void show(const char* name);
152 
156  CLASS_DECLSPEC
157  void show(Visualizer2* pVis,const Color& color);
158 
159 
167  CLASS_DECLSPEC
168  void getOriginalConstraintSegments(std::vector<ConstraintSegment2*>& vConstraintSegments_) const;
169 
176  CLASS_DECLSPEC
177  void getChildConstraintSegments(std::vector<ConstraintSegment2*>& vConstraintSegments_) const;
178 
180 bool dbg_hasDirection(ConstraintSegment2* pCSeg) const;
181 
183 void updateSplittedConstraintSegment(
184  ConstraintSegment2* pCSeg,
185  bool bUpdateCMGR);
189  Dt2* getDt2();
199  CLASS_DECLSPEC
202  void getAliveConstraintChain(std::vector<ConstraintSegment2*>& vAliveCSeg) ; // For debugging
204  void setDirectionsRecursive(std::vector<ConstraintSegment2*>& vCSegments);
217  CLASS_DECLSPEC
218  bool isReverse(ConstraintSegment2* pCSeg) const;
219 
220 
244  CLASS_DECLSPEC
245  bool makeDelaunay(double minLength);
246 
247 protected:
249  bool checkAndSortPolygon(std::vector<ConstraintSegment2*>& vCSegments_);
251  bool checkAndSortPolygonSub(std::vector<ConstraintSegment2*>& vCSegments);
253  void makeSelfOwner(std::vector<ConstraintSegment2*>& vCSeg);
254 
255  // Data
256  Dt2* pDt2;
257  GeomTest* pGeomPredicates;
259  std::vector<ConstraintSegment2*> vCSegParents;
260  bool bIsPolygon;
261  std::map<ConstraintSegment2*,bool,func_ltDerefPtr<ConstraintSegment2*> > mCSegReverse;
262  std::map<Point2*,size_t> mSplitPointNum;
263  bool bIsOriented;
264 
265 private:
267  ConstraintGraph2& operator=(const ConstraintGraph2&);
268 
269 };
270 
271 } // (namespace)
ConstraintInsertionStrategy
Constraint Insertion Strategy determines how a constraint edge shall be inserted:
Definition: ConstraintSegment2.h:52
Color for visualization.
Definition: Color.h:59
ConstraintGraph2 is a set of Constraint Edges (ConstraintSegment2)
Definition: ConstraintGraph2.h:52
bool isReverse(ConstraintSegment2 *pCSeg) const
bool isOriented() const
Are the segments of the constraint graph oriented?
ConstraintInsertionStrategy getInsertionStrategy() const
Get the constraint insertion strategy.
void show(const char *name)
Visualization.
bool isConstraint(ConstraintSegment2 *pCSeg) const
Check if a ConstraintSegment2 is a member.
bool isPolygon() const
Does the constraint graph form a closed polygon?
void getPolygonVertices(std::vector< Point2 * > &vVertices_)
Get the vertices of the constraint segments.
void show(Visualizer2 *pVis, const Color &color)
Visualization.
bool isConstraint(Point2 *p0, Point2 *p1) const
Check if an edge is a constraint.
void getDirectChildren(ConstraintSegment2 *pParent, ConstraintSegment2 *&pChild0, ConstraintSegment2 *&pChild1)
Get direct children.
void getChildConstraintSegments(std::vector< ConstraintSegment2 * > &vConstraintSegments_) const
Get child ConstraintSegment2 objects.
void getOriginalConstraintSegments(std::vector< ConstraintSegment2 * > &vConstraintSegments_) const
Get the original ConstraintSegment2 objects.
bool makeDelaunay(double minLength)
A ConstraintSegment2 represents a Constraint Edge.
Definition: ConstraintSegment2.h:69
Point.
Definition: Point2.h:43
Visualizer2 is a general Postscript writer. It draws the objects Point2, Segment2,...
Definition: Visualizer2.h:56