Geom Software - C++ Programming and Geometry Libraries
Fade2D Documentation pages v1.55
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 
127  CLASS_DECLSPEC
128  bool isConstraint(Point2* p0,Point2* p1) const;
129 
130 
131 
135  CLASS_DECLSPEC
136  void show(const std::string& name);
137 
141  CLASS_DECLSPEC
142  void show(Visualizer2* pVis,const Color& color);
143 
144 
152  CLASS_DECLSPEC
153  void getOriginalConstraintSegments(std::vector<ConstraintSegment2*>& vConstraintSegments_) const;
154 
161  CLASS_DECLSPEC
162  void getChildConstraintSegments(std::vector<ConstraintSegment2*>& vConstraintSegments_) const;
163 
165 void updateSplittedConstraintSegment(
166  ConstraintSegment2* pCSeg,
167  bool bDirChange0,
168  bool bDirChange1,
169  ConstraintSegment2* pChild0,
170  ConstraintSegment2* pChild1,
171  bool bUpdateCMGR);
175  Dt2* getDt2();
185  CLASS_DECLSPEC
186  void getDirectChildren(ConstraintSegment2* pParent,ConstraintSegment2*& pChild0,ConstraintSegment2*& pChild1);
188  void getAliveConstraintChain(std::vector<ConstraintSegment2*>& vAliveCSeg) ; // For debugging
189  //void getAliveConstraintChain_old(std::vector<ConstraintSegment2*>& vAliveCSeg);
190 protected:
192  bool isReverse(ConstraintSegment2* pCSeg) const;
194  bool checkAndSortPolygon(std::vector<ConstraintSegment2*>& vCSegments_);
196  void makeSelfOwner(std::vector<ConstraintSegment2*>& vCSeg);
197 
198  // Data
199  Dt2* pDt2;
200  GeomTest* pGeomPredicates;
201  ConstraintInsertionStrategy cis;
202  std::vector<ConstraintSegment2*> vCSegParents;
203  bool bIsPolygon;
204  std::map<ConstraintSegment2*,bool,func_ltDerefPtr<ConstraintSegment2*> > mCSegReverse;
205  std::map<Point2*,size_t> mSplitPointNum;
206  bool bIsOriented;
207 };
208 
209 } // (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:50
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