Fade2.5D Documentation pages v2.03
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
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  CLASS_DECLSPEC
124  bool operator<(const ConstraintSegment2& pOther) const
125  {
126  if(p0<pOther.p0) return true;
127  if(p0>pOther.p0) return false;
128  return p1<pOther.p1;
129  }
130 
131 
146  CLASS_DECLSPEC
147  Point2* insertAndSplit(const Point2& splitPoint);
148 
153  CLASS_DECLSPEC
155 //*
156 //* internal use. Deprecated!
157 //*/
159  CLASS_DECLSPEC
160  bool splitAndRemovePrev(const Point2& split);
161 
162 
163 //Sets a specific ConstraintGraph2 as owner of the current ConstraintSegment2.
165  void addOwnerRecursive(ConstraintGraph2* pOwner);
166 
167 // Removes a specific ConstraintGraph2 as owner of the current ConstraintSegment2.
169  void removeOwner(ConstraintGraph2* pOwner);
170  CLASS_DECLSPEC
174  void getChildrenRec(std::vector<ConstraintSegment2*>& vChildConstraintSegments);
175  CLASS_DECLSPEC
180  CLASS_DECLSPEC
181  friend std::ostream &operator<<(std::ostream &stream, const ConstraintSegment2& cSeg);
182 
183 
185  CLASS_DECLSPEC
186  size_t getNumberOfOwners() const;
187 
188 
189 
190 //* A customer specific method, not thought for public use. If the
191 //* current constraint segment is a border segment, then the area of
192 //* the (non-existing) outside triangle can manually be deposited
193 //* here. This value is used by the extended meshing method when a
194 //* grow factor is given or ignored if not set.
196  CLASS_DECLSPEC
197  void setAdjacentArea(double adjacentArea_);
198 
199 
200 
201 //* A customer specific method, not thought for public use. Returns
202 //* a previously via setAdjacentArea(double adjacentArea_) deposited
203 //* value. If not explicitly set, DBL_MAX is returned.
205  CLASS_DECLSPEC
206  double getAdjacentArea() const;
207 
208 static int runningLabel;
209  int label;
210 protected:
212  std::set<ConstraintGraph2*> sOwners;
213 
214  Point2 *p0,*p1;
216  bool bAlive;
217 
218  std::vector<ConstraintSegment2*> vChildren;
220  double adjacentArea;
221 
222 
223 };
224 
225 } // 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_CONSTRAINED_DELAUNAY
The recommended insertion strategy.
Definition: ConstraintSegment2.h:54
@ CIS_CONFORMING_DELAUNAY
Deprecated.
Definition: ConstraintSegment2.h:53
@ CIS_CONFORMING_DELAUNAY_SEGMENT_LEVEL
Deprecated.
Definition: ConstraintSegment2.h:56
@ CIS_IGNORE_DELAUNAY
Deprecated.
Definition: ConstraintSegment2.h:59
@ CIS_KEEP_DELAUNAY
Deprecated name.
Definition: ConstraintSegment2.h:58
ConstraintGraph2 is a set of Constraint Edges (ConstraintSegment2)
Definition: ConstraintGraph2.h:52
A ConstraintSegment2 represents a Constraint Edge.
Definition: ConstraintSegment2.h:69
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 * getTrg() const
Get the second endpoint.
ConstraintInsertionStrategy getCIS() const
Get the Constraint Insertion Strategy (CIS)
bool isAlive() const
Check if the present ConstraintSegment2 is alive.
Point2 * insertAndSplit(const Point2 &splitPoint)
Split a constraint segment.
bool operator<(const ConstraintSegment2 &pOther) const
operator<(..) Compares the vertex pointers of the endpoints, not the length
Definition: ConstraintSegment2.h:124
void getChildrenRec(std::vector< ConstraintSegment2 * > &vChildConstraintSegments)
Get all children Recursively retrieve all children of the current ConstraintSegment2.
bool split_combinatorialOnly(Point2 *pSplit)
Split a constraint segment.
Point2 * getSrc() const
Get the first endpoint.
Point.
Definition: Point2.h:43