Geom Software - C++ Programming and Geometry Libraries
Fade2D Documentation pages v1.74
ConstraintSegment2.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 #pragma once
19 #include <set>
20 
21 #include "common.h"
22 #if GEOM_PSEUDO3D==GEOM_TRUE
23  namespace GEOM_FADE25D {
24 #elif GEOM_PSEUDO3D==GEOM_FALSE
25  namespace GEOM_FADE2D {
26 #else
27  #error GEOM_PSEUDO3D is not defined
28 #endif
29 
30 class Point2; // FWD
31 class ConstraintGraph2; // FWD
32 class ConstraintMgr; // FWD
33 
57 enum ConstraintInsertionStrategy
58 {
59  CIS_CONFORMING_DELAUNAY=0,
60  CIS_CONSTRAINED_DELAUNAY=1,
61 #if GEOM_PSEUDO3D==GEOM_TRUE
62  CIS_CONFORMING_DELAUNAY_SEGMENT_LEVEL=2,
63 #endif
64  CIS_KEEP_DELAUNAY=0, // Deprecated name
65  CIS_IGNORE_DELAUNAY=1 // Deprecated name
66 };
67 
75 {
76 private:
77  // ConstraintSegment2 objects are only made by ConstraintMgr/ConstraintGraph2
78  ConstraintSegment2(Point2* p0_,Point2* p1_,ConstraintInsertionStrategy cis_);
79  friend class ConstraintMgr;
80  friend class ConstraintGraph2;
81 public:
82 
87  CLASS_DECLSPEC
88  Point2* getSrc() const;
92  CLASS_DECLSPEC
93  Point2* getTrg() const;
95  void kill();
96 
98  bool dbg_hasDirection();
99 
100 // Reanimate a constraint segment
102  void unkill();
103 
107  CLASS_DECLSPEC
108  bool isAlive() const;
109 
114  ConstraintInsertionStrategy getCIS() const;
115 
116 
120  CLASS_DECLSPEC
121  bool operator<(const ConstraintSegment2& pOther) const;
122 
137  CLASS_DECLSPEC
138  Point2* insertAndSplit(const Point2& splitPoint);
139 
144  CLASS_DECLSPEC
145  bool split_combinatorialOnly(Point2* pSplit);
146 
147 
148 //*
149 //* internal use. Deprecated!
150 //*/
151  CLASS_DECLSPEC
152  bool splitAndRemovePrev(const Point2& split);
153  //bool splitAndRemovePrev_deprecated(Point2* pSplit);
154 
155 //Sets a specific ConstraintGraph2 as owner of the current ConstraintSegment2.
157  void addOwnerRecursive(ConstraintGraph2* pOwner);
158 
159 // Removes a specific ConstraintGraph2 as owner of the current ConstraintSegment2.
161  void removeOwner(ConstraintGraph2* pOwner);
162  CLASS_DECLSPEC
166  void getChildrenRec(std::vector<ConstraintSegment2*>& vChildConstraintSegments);
167  CLASS_DECLSPEC
171  void getChildrenAndSplitPoint(ConstraintSegment2*& pCSeg0,ConstraintSegment2*& pCSeg1,Point2*& pSplitPoint);
172  CLASS_DECLSPEC
173  friend std::ostream &operator<<(std::ostream &stream, const ConstraintSegment2& cSeg);
174 
176  CLASS_DECLSPEC
177  size_t getNumberOfOwners() const;
178 
179 
180 
181 //* A customer specific method, not thought for public use. If the
182 //* current constraint segment is a border segment, then the area of
183 //* the (non-existing) outside triangle can manually be deposited
184 //* here. This value is used by the extended meshing method when a
185 //* grow factor is given or ignored if not set.
187  CLASS_DECLSPEC
188  void setAdjacentArea(double adjacentArea_);
189 
190 
191 
192 //* A customer specific method, not thought for public use. Returns
193 //* a previously via setAdjacentArea(double adjacentArea_) deposited
194 //* value. If not explicitly set, DBL_MAX is returned.
196  CLASS_DECLSPEC
197  double getAdjacentArea() const;
198 
199  // temporarily public
201  std::set<ConstraintGraph2*> sOwners;
202 
203  int label;
204 protected:
205 
206  Point2 *p0,*p1;
207  ConstraintInsertionStrategy cis;
208  bool bAlive;
209 
210  std::vector<ConstraintSegment2*> vChildren;
212  double adjacentArea;
213 
214  static int runningLabel;
215 };
216 
217 } // NAMESPACE
Point.
Definition: Point2.h:39
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