Geom Software - C++ Programming and Geometry Libraries
Fade2D Documentation pages v1.52
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 
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 
71 {
72 public:
73  ConstraintSegment2(Point2* p0_,Point2* p1_,ConstraintInsertionStrategy cis_);
78  CLASS_DECLSPEC
79  Point2* getSrc() const;
83  CLASS_DECLSPEC
84  Point2* getTrg() const;
85 
90  void kill();
91 
96  void unkill();
97 
101  CLASS_DECLSPEC
102  bool isAlive() const;
106  ConstraintInsertionStrategy getCIS() const;
107 
112  CLASS_DECLSPEC
113  bool operator<(const ConstraintSegment2& pOther) const;
114 
129  CLASS_DECLSPEC
130  Point2* insertAndSplit(const Point2& splitPoint);
131 
136  CLASS_DECLSPEC
137  bool split_combinatorialOnly(Point2* pSplit);
142  CLASS_DECLSPEC
143  bool splitAndRemovePrev(const Point2& split);
144 
145  //bool splitAndRemovePrev_deprecated(Point2* pSplit);
151  void addOwner(ConstraintGraph2* pOwner);
156  void removeOwner(ConstraintGraph2* pOwner);
157  CLASS_DECLSPEC
161  void getChildrenRec(std::vector<ConstraintSegment2*>& vChildConstraintSegments);
162  CLASS_DECLSPEC
166  void getChildrenAndSplitPoint(ConstraintSegment2*& pCSeg0,ConstraintSegment2*& pCSeg1,Point2*& pSplitPoint);
167  CLASS_DECLSPEC
168  friend std::ostream &operator<<(std::ostream &stream, const ConstraintSegment2& cSeg);
172  CLASS_DECLSPEC
173  size_t getNumberOfOwners() const;
174 
175 
184  CLASS_DECLSPEC
185  void setAdjacentArea(double adjacentArea_);
186 
192  CLASS_DECLSPEC
193  double getAdjacentArea() const;
194 
195 
196 protected:
197 
198  Point2 *p0,*p1;
199  ConstraintInsertionStrategy cis;
200  bool bAlive;
201  std::set<ConstraintGraph2*> sOwners;
202  std::vector<ConstraintSegment2*> vChildren;
203  double adjacentArea;
204 
205 };
206 
207 } // NAMESPACE
Point.
Definition: Point2.h:39
ConstraintGraph2 is a set of enforced edges.
Definition: ConstraintGraph2.h:47
Constraint segment.
Definition: ConstraintSegment2.h:70
Definition: Bbox2.h:25