Fade2D Documentation pages v2.12
Delaunay Features
ConstraintSegment2.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 #pragma once
20 #include <set>
21 
22 #include "common.h"
23 #if GEOM_PSEUDO3D==GEOM_TRUE
24  namespace GEOM_FADE25D {
25 #elif GEOM_PSEUDO3D==GEOM_FALSE
26  namespace GEOM_FADE2D {
27 #else
28  #error GEOM_PSEUDO3D is not defined
29 #endif
30 
31 class Point2; // FWD
32 class ConstraintGraph2; // FWD
33 class ConstraintMgr; // FWD
34 
52 {
55 #if GEOM_PSEUDO3D==GEOM_TRUE
56  CIS_CONFORMING_DELAUNAY_SEGMENT_LEVEL=2,
57 #endif
60 };
61 
69 {
70 private:
71  // ConstraintSegment2 objects are only made by ConstraintMgr/ConstraintGraph2
73  friend class ConstraintMgr;
74  friend class ConstraintGraph2;
75 public:
80  CLASS_DECLSPEC
81  Point2* getSrc() const;
85  CLASS_DECLSPEC
86  Point2* getTrg() const;
88  void kill() // Only for internal use!
89  {
90  bAlive=false;
91  }
92 
93 
94 
95 
97  bool dbg_hasDirection();
98 
99 // Reanimate a constraint segment
101  void unkill() // Only for internal use!
102  {
103  bAlive=true;
104  }
105 
110  CLASS_DECLSPEC
111  bool isAlive() const;
112 
118 
119 
123  inline bool operator<(const ConstraintSegment2& pOther) const
124  {
125  if(p0<pOther.p0) return true;
126  if(p0>pOther.p0) return false;
127  return p1<pOther.p1;
128  }
129 
130 
145  CLASS_DECLSPEC
146  Point2* insertAndSplit(const Point2& splitPoint);
147 
152  CLASS_DECLSPEC
154 //*
155 //* internal use. Deprecated!
156 //*/
158  CLASS_DECLSPEC
159  bool splitAndRemovePrev(const Point2& split);
160 
161 
162 //Sets a specific ConstraintGraph2 as owner of the current ConstraintSegment2.
164  void addOwnerRecursive(ConstraintGraph2* pOwner);
165 
166 // Removes a specific ConstraintGraph2 as owner of the current ConstraintSegment2.
168  void removeOwner(ConstraintGraph2* pOwner);
169  CLASS_DECLSPEC
173  void getChildrenRec(std::vector<ConstraintSegment2*>& vChildConstraintSegments);
174  CLASS_DECLSPEC
179  CLASS_DECLSPEC
180  friend std::ostream &operator<<(std::ostream &stream, const ConstraintSegment2& cSeg);
181 
182 
184  CLASS_DECLSPEC
185  size_t getNumberOfOwners() const;
186 
187 
188 
189 //* A customer specific method, not thought for public use. If the
190 //* current constraint segment is a border segment, then the area of
191 //* the (non-existing) outside triangle can manually be deposited
192 //* here. This value is used by the extended meshing method when a
193 //* grow factor is given or ignored if not set.
195  CLASS_DECLSPEC
196  void setAdjacentArea(double adjacentArea_);
197 
198  CLASS_DECLSPEC
199  int getLabel() const;
200 
201  CLASS_DECLSPEC
202  std::string getLabelString() const;
203 
204 
205 //* A customer specific method, not thought for public use. Returns
206 //* a previously via setAdjacentArea(double adjacentArea_) deposited
207 //* value. If not explicitly set, DBL_MAX is returned.
209  CLASS_DECLSPEC
210  double getAdjacentArea() const;
211 
212 static int runningLabel;
213  int label;
214 protected:
216  std::set<ConstraintGraph2*> sOwners;
217 
218  Point2 *p0,*p1;
220  bool bAlive;
221 
222  std::vector<ConstraintSegment2*> vChildren;
224  double adjacentArea;
225 
226 
227 };
228 
229 } // NAMESPACE
std::ostream & operator<<(std::ostream &stream, const Bbox2 &pC)
Print the box.
Definition: Bbox2.h:492
ConstraintInsertionStrategy
Constraint Insertion Strategy determines how a constraint edge shall be inserted:
Definition: ConstraintSegment2.h:52
@ CIS_KEEP_DELAUNAY
Deprecated name.
Definition: ConstraintSegment2.h:58
@ CIS_CONSTRAINED_DELAUNAY
The recommended insertion strategy.
Definition: ConstraintSegment2.h:54
@ CIS_CONFORMING_DELAUNAY
Deprecated.
Definition: ConstraintSegment2.h:53
@ CIS_IGNORE_DELAUNAY
Deprecated.
Definition: ConstraintSegment2.h:59
ConstraintGraph2 is a set of Constraint Edges (ConstraintSegment2)
Definition: ConstraintGraph2.h:52
A ConstraintSegment2 represents a Constraint Edge.
Definition: ConstraintSegment2.h:69
Point2 * getTrg() const
Get the second endpoint.
bool operator<(const ConstraintSegment2 &pOther) const
operator<(..) Compares the vertex pointers of the endpoints, not the length
Definition: ConstraintSegment2.h:123
void getChildrenAndSplitPoint(ConstraintSegment2 *&pCSeg0, ConstraintSegment2 *&pCSeg1, Point2 *&pSplitPoint)
Get the children and the split point Retrieve the two direct children of the current ConstraintSegmen...
Point2 * getSrc() const
Get the first endpoint.
bool isAlive() const
Check if the present ConstraintSegment2 is alive.
Point2 * insertAndSplit(const Point2 &splitPoint)
Split a constraint segment.
bool split_combinatorialOnly(Point2 *pSplit)
Split a constraint segment.
ConstraintInsertionStrategy getCIS() const
Get the Constraint Insertion Strategy (CIS)
void getChildrenRec(std::vector< ConstraintSegment2 * > &vChildConstraintSegments)
Get all children Recursively retrieve all children of the current ConstraintSegment2.
Point.
Definition: Point2.h:52