Fade2.5D Documentation pages v2.16.7
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 
56 {
57 public:
59  CLASS_DECLSPEC
61  Dt2* pDt2_,
62  std::vector<ConstraintSegment2*>& vCSegments,
64  );
65 
67  CLASS_DECLSPEC
69  Dt2* pDt2_,
70  std::vector<ConstraintSegment2*>& vCSegments_,
71  std::map<std::pair<Point2*,Point2*>,bool > mPPReverse,
73  );
74 
76  void init(std::vector<ConstraintSegment2*>& vCSegments_); // Internal use
77 
79  bool isDualOwned(ConstraintSegment2* pCSeg) ; // Internal use
80 
81 
91  CLASS_DECLSPEC
92  bool isPolygon() const;
93 
94 
104  CLASS_DECLSPEC
105  bool isOriented() const;
106 
107 
129  CLASS_DECLSPEC
130  void getPolygonVertices(std::vector<Point2*>& vVertices) ;
131 
132 
143  CLASS_DECLSPEC
145 
155  CLASS_DECLSPEC
156  bool isConstraint(Point2* p0,Point2* p1) const;
157 
171  CLASS_DECLSPEC
172  bool isConstraint(ConstraintSegment2* pCSeg) const;
173 
182  CLASS_DECLSPEC
183  void show(const char* name);
184 
197  CLASS_DECLSPEC
198  void show(Visualizer2* pVis,const Color& color);
199 
211  CLASS_DECLSPEC
212  void getOriginalConstraintSegments(std::vector<ConstraintSegment2*>& vConstraintSegments_) const;
213 
214 
223  CLASS_DECLSPEC
224  void getChildConstraintSegments(std::vector<ConstraintSegment2*>& vConstraintSegments_) const;
225 
227 bool dbg_hasDirection(ConstraintSegment2* pCSeg) const;
228 
230 void updateSplittedConstraintSegment(
231  ConstraintSegment2* pCSeg,
232  bool bUpdateCMGR);
234 Dt2* getDt2();
235 
249  CLASS_DECLSPEC
252  void getAliveConstraintChain(std::vector<ConstraintSegment2*>& vAliveCSeg) ; // For debugging
254  void setDirectionsRecursive(const std::vector<ConstraintSegment2*>& vCSegments);
266  CLASS_DECLSPEC
267  bool isReverse(ConstraintSegment2* pCSeg) const;
268 
287  CLASS_DECLSPEC
288  bool makeDelaunay(double minLength);
289 
290 protected:
292  bool checkAndSortPolygon(std::vector<ConstraintSegment2*>& vCSegments_);
294  bool checkAndSortPolygonSub(std::vector<ConstraintSegment2*>& vCSegments);
296  void makeSelfOwner(std::vector<ConstraintSegment2*>& vCSeg);
297 
298  // Data
299  Dt2* pDt2;
300  GeomTest* pGeomPredicates;
302  std::vector<ConstraintSegment2*> vCSegParents;
303  bool bIsPolygon;
304  std::map<ConstraintSegment2*,bool,func_ltDerefPtr<ConstraintSegment2*> > mCSegReverse;
305  std::map<Point2*,size_t> mSplitPointNum;
306  bool bIsOriented;
307 
308 private:
310  ConstraintGraph2& operator=(const ConstraintGraph2&);
311 
312 };
313 
314 } // (namespace)
ConstraintInsertionStrategy
Enum defining the available strategies for inserting constraints.
Definition: ConstraintSegment2.h:44
Color for visualization.
Definition: Color.h:61
A constraint graph is a collection of constraint edges (ConstraintSegment2).
Definition: ConstraintGraph2.h:56
CLASS_DECLSPEC ConstraintInsertionStrategy getInsertionStrategy() const
Gets the constraint insertion strategy.
CLASS_DECLSPEC void show(const char *name)
Visualizes the ConstraintGraph2 as a PostScript or PDF file.
CLASS_DECLSPEC bool isPolygon() const
Checks if the constraint graph forms a closed polygon.
CLASS_DECLSPEC bool makeDelaunay(double minLength)
Improves the triangle quality (makes Delaunay).
CLASS_DECLSPEC void getChildConstraintSegments(std::vector< ConstraintSegment2 * > &vConstraintSegments_) const
Get the current ConstraintSegment2 objects.
CLASS_DECLSPEC void getOriginalConstraintSegments(std::vector< ConstraintSegment2 * > &vConstraintSegments_) const
Gets the original ConstraintSegment2 objects.
CLASS_DECLSPEC void getPolygonVertices(std::vector< Point2 * > &vVertices)
Retrieves the vertices of the constraint segments.
CLASS_DECLSPEC void show(Visualizer2 *pVis, const Color &color)
Visualizes the ConstraintGraph2 as a PostScript or PDF file.
CLASS_DECLSPEC bool isConstraint(ConstraintSegment2 *pCSeg) const
Checks if a ConstraintSegment2 is part of the current ConstraintGraph2.
CLASS_DECLSPEC bool isConstraint(Point2 *p0, Point2 *p1) const
Check if an edge is a ConstraintSegment2 of the current ConstraintGraph2.
CLASS_DECLSPEC void getDirectChildren(ConstraintSegment2 *pParent, ConstraintSegment2 *&pChild0, ConstraintSegment2 *&pChild1)
Get the direct children of a ConstraintSegment2.
CLASS_DECLSPEC bool isReverse(ConstraintSegment2 *pCSeg) const
Get the orientation of a ConstraintSegment2.
CLASS_DECLSPEC bool isOriented() const
Checks if the segments of the ConstraintGraph2 are oriented.
A ConstraintSegment2 represents a constraint edge between two vertices of a Delaunay triangulation.
Definition: ConstraintSegment2.h:71
Represents a 2.5D point.
Definition: Point2.h:61
A PDF and Postscript Writer for 2D Visualization.
Definition: Visualizer2.h:60