Geom Software - C++ Programming and Geometry Libraries
Fade2D Documentation pages v1.58
ConstraintGraph2.h
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 
18 
19 #pragma once
20 #include "Segment2.h"
21 #include "ConstraintSegment2.h"
22 #include "Edge2.h"
23 #include <map>
24 
25 
26 #include "common.h"
27 #if GEOM_PSEUDO3D==GEOM_TRUE
28  namespace GEOM_FADE25D {
29 #elif GEOM_PSEUDO3D==GEOM_FALSE
30  namespace GEOM_FADE2D {
31 #else
32  #error GEOM_PSEUDO3D is not defined
33 #endif
34 
35 // FWD
36 class Dt2;
37 class ConstraintSegment2;
38 class GeomTest;
39 class Visualizer2;
40 class Color;
41 
50 {
51 public:
53  CLASS_DECLSPEC
55  Dt2* pDt2_,
56  std::vector<ConstraintSegment2*>& vCSegments,
57  ConstraintInsertionStrategy
58  );
59 
61  CLASS_DECLSPEC
62  ConstraintGraph2(
63  Dt2* pDt2_,
64  std::vector<ConstraintSegment2*>& vCSegments_,
65  std::map<std::pair<Point2*,Point2*>,bool > mPPReverse,
66  ConstraintInsertionStrategy cis_
67  );
68 
70  void init(std::vector<ConstraintSegment2*>& vCSegments_);
71 
72 
80  CLASS_DECLSPEC
81  bool isPolygon() const;
82 
89  CLASS_DECLSPEC
90  bool isOriented() const;
91 
106  CLASS_DECLSPEC
107  void getPolygonVertices(std::vector<Point2*>& vTriangulationPoints_) ;
108 
109 
120  CLASS_DECLSPEC
121  ConstraintInsertionStrategy getInsertionStrategy() const;
122 
128  CLASS_DECLSPEC
129  bool isConstraint(Point2* p0,Point2* p1) const;
130 
139  CLASS_DECLSPEC
140  bool isConstraint(ConstraintSegment2* pCSeg) const;
141 
142 
146  CLASS_DECLSPEC
147  void show(const std::string& name);
148 
152  CLASS_DECLSPEC
153  void show(Visualizer2* pVis,const Color& color);
154 
155 
163  CLASS_DECLSPEC
164  void getOriginalConstraintSegments(std::vector<ConstraintSegment2*>& vConstraintSegments_) const;
165 
172  CLASS_DECLSPEC
173  void getChildConstraintSegments(std::vector<ConstraintSegment2*>& vConstraintSegments_) const;
174 
176 bool dbg_hasDirection(ConstraintSegment2* pCSeg) const;
177 
178 
180 //void updateSplittedConstraintSegment(
181  //ConstraintSegment2* pCSeg,
182  //bool bDirChange0,
183  //bool bDirChange1,
184  //ConstraintSegment2* pChild0,
185  //ConstraintSegment2* pChild1,
186  //bool bUpdateCMGR);
188 void updateSplittedConstraintSegment(
189  ConstraintSegment2* pCSeg,
190  bool bUpdateCMGR);
194  Dt2* getDt2();
204  CLASS_DECLSPEC
205  void getDirectChildren(ConstraintSegment2* pParent,ConstraintSegment2*& pChild0,ConstraintSegment2*& pChild1);
207  void getAliveConstraintChain(std::vector<ConstraintSegment2*>& vAliveCSeg) ; // For debugging
209  void setDirectionsRecursive(std::vector<ConstraintSegment2*>& vCSegments);
222  CLASS_DECLSPEC
223  bool isReverse(ConstraintSegment2* pCSeg) const;
224  //void getAliveConstraintChain_old(std::vector<ConstraintSegment2*>& vAliveCSeg);
225 protected:
226 
228  bool checkAndSortPolygon(std::vector<ConstraintSegment2*>& vCSegments_);
230  bool checkAndSortPolygonSub(std::vector<ConstraintSegment2*>& vCSegments);
232  void makeSelfOwner(std::vector<ConstraintSegment2*>& vCSeg);
233 
234  // Data
235  Dt2* pDt2;
236  GeomTest* pGeomPredicates;
237  ConstraintInsertionStrategy cis;
238  std::vector<ConstraintSegment2*> vCSegParents;
239  bool bIsPolygon;
240  std::map<ConstraintSegment2*,bool,func_ltDerefPtr<ConstraintSegment2*> > mCSegReverse;
241  std::map<Point2*,size_t> mSplitPointNum;
242  bool bIsOriented;
243 };
244 
245 } // (namespace)
Point.
Definition: Point2.h:39
Visualizer2 is a general Postscript writer. It draws the objects Point2, Segment2, Triangle2, Circle2 and Label.
Definition: Visualizer2.h:51
Color.
Definition: Color.h:58
ConstraintGraph2 is a set of Constraint Edges to be enforced. These are ConstraintSegment2 objects...
Definition: ConstraintGraph2.h:49
A ConstraintSegment2 represents a Constraint Edge.
Definition: ConstraintSegment2.h:74
Definition: Bbox2.h:25