Geom Software - C++ Programming and Geometry Libraries
Fade2D Documentation pages v1.60
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 
107  CLASS_DECLSPEC
108  void getPolygonVertices(std::vector<Point2*>& vVertices_) ;
109 
110 
121  CLASS_DECLSPEC
122  ConstraintInsertionStrategy getInsertionStrategy() const;
123 
129  CLASS_DECLSPEC
130  bool isConstraint(Point2* p0,Point2* p1) const;
131 
140  CLASS_DECLSPEC
141  bool isConstraint(ConstraintSegment2* pCSeg) const;
142 
143 
147  CLASS_DECLSPEC
148  void show(const std::string& name);
149 
153  CLASS_DECLSPEC
154  void show(Visualizer2* pVis,const Color& color);
155 
156 
164  CLASS_DECLSPEC
165  void getOriginalConstraintSegments(std::vector<ConstraintSegment2*>& vConstraintSegments_) const;
166 
173  CLASS_DECLSPEC
174  void getChildConstraintSegments(std::vector<ConstraintSegment2*>& vConstraintSegments_) const;
175 
177 bool dbg_hasDirection(ConstraintSegment2* pCSeg) const;
178 
179 
181 //void updateSplittedConstraintSegment(
182  //ConstraintSegment2* pCSeg,
183  //bool bDirChange0,
184  //bool bDirChange1,
185  //ConstraintSegment2* pChild0,
186  //ConstraintSegment2* pChild1,
187  //bool bUpdateCMGR);
189 void updateSplittedConstraintSegment(
190  ConstraintSegment2* pCSeg,
191  bool bUpdateCMGR);
195  Dt2* getDt2();
205  CLASS_DECLSPEC
206  void getDirectChildren(ConstraintSegment2* pParent,ConstraintSegment2*& pChild0,ConstraintSegment2*& pChild1);
208  void getAliveConstraintChain(std::vector<ConstraintSegment2*>& vAliveCSeg) ; // For debugging
210  void setDirectionsRecursive(std::vector<ConstraintSegment2*>& vCSegments);
223  CLASS_DECLSPEC
224  bool isReverse(ConstraintSegment2* pCSeg) const;
225  //void getAliveConstraintChain_old(std::vector<ConstraintSegment2*>& vAliveCSeg);
226 protected:
227 
229  bool checkAndSortPolygon(std::vector<ConstraintSegment2*>& vCSegments_);
231  bool checkAndSortPolygonSub(std::vector<ConstraintSegment2*>& vCSegments);
233  void makeSelfOwner(std::vector<ConstraintSegment2*>& vCSeg);
234 
235  // Data
236  Dt2* pDt2;
237  GeomTest* pGeomPredicates;
238  ConstraintInsertionStrategy cis;
239  std::vector<ConstraintSegment2*> vCSegParents;
240  bool bIsPolygon;
241  std::map<ConstraintSegment2*,bool,func_ltDerefPtr<ConstraintSegment2*> > mCSegReverse;
242  std::map<Point2*,size_t> mSplitPointNum;
243  bool bIsOriented;
244 };
245 
246 } // (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