Geom Software - C++ Programming and Geometry Libraries
Fade2D Documentation pages v1.56
Zone2.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 
20 #include "common.h"
21 #include "Bbox2.h"
22 #include "Edge2.h"
23 #include "Segment2.h"
24 #include "UserPredicates.h"
25 
26 #if GEOM_PSEUDO3D==GEOM_TRUE
27  namespace GEOM_FADE25D {
28 #elif GEOM_PSEUDO3D==GEOM_FALSE
29  namespace GEOM_FADE2D {
30 #else
31  #error GEOM_PSEUDO3D is not defined
32 #endif
33 
34 
35 class Dt2; // Fwd
36 class ConstraintGraph2; // Fwd
37 class Triangle2; // Fwd
38 class Point2; // Fwd
39 class Visualizer2; // Fwd
48 class CLASS_DECLSPEC Zone2
49 {
50 public:
52  Zone2(Dt2* pDt_,ZoneLocation zoneLoc_);
54  Zone2(Dt2* pDt_,ZoneLocation zoneLoc_,ConstraintGraph2* pConstraintGraph_);
56  Zone2(Dt2* pDt_,ZoneLocation zoneLoc_,const std::vector<ConstraintGraph2*>& vConstraintGraphs_);
58  Zone2(Dt2* pDt_,const std::vector<ConstraintGraph2*>& vConstraintGraphs_,ZoneLocation zoneLoc_,std::vector<Point2>& vStartPoints);
59 
70  ZoneLocation getZoneLocation() const;
71 
84  Zone2* convertToBoundedZone();
85 
93  void show(const std::string& postscriptFilename,bool bShowFull,bool bWithConstraints) const;
94 
102  void show(Visualizer2* pVisualizer,bool bShowFull,bool bWithConstraints) const;
103 
104 #if GEOM_PSEUDO3D==GEOM_TRUE
105 
111  void showGeomview(const std::string& filename,const std::string& color) const;
112 #endif
113 
114 #if GEOM_PSEUDO3D==GEOM_TRUE
115 
116 
117 void analyzeAngles();
121 void slopeValleyRidgeOptimization();
122 
167  void optimizeValleysAndRidges(double tolerance2D,double lowerThreshold25D);
168 #endif
169 
192 void unifyGrid(double tolerance);
193 
195  bool assignDt2(Dt2* pDt_);
196 
205  void getTriangles(std::vector<Triangle2*>& vTriangles_) const;
206 
210  void getVertices(std::vector<Point2*>& vVertices_) const;
211 
212 
217 void statistics(const std::string& s) const;
218 
219 
224  ConstraintGraph2* getConstraintGraph() const;
225 
230  size_t getNumberOfTriangles() const;
231 
232 
236  void getConstraintGraphs(std::vector<ConstraintGraph2*>& vConstraintGraphs_) const;
237 
239  Dt2* getDelaunayTriangulation() const;
240 
245  size_t numberOfConstraintGraphs() const;
246 
249  void debug(std::string name="");
250 
253  Bbox2 getBoundingBox() const;
254 
257  void getBoundaryEdges(std::vector<Edge2>& vEdges) const;
258 
261  void getBoundarySegments(std::vector<Segment2>& vSegments) const;
262 
275  double getArea2D() const;
276 
277 
278 #if GEOM_PSEUDO3D==GEOM_TRUE
279 
286  double getArea25D() const;
287 #endif
288 
292  void getBorderEdges(std::vector<Edge2>& vBorderEdgesOut) const;
293 
294 
295 protected:
297  Zone2(const Zone2&);
299  void getTriangles_RESULT(std::vector<Triangle2*>& vTriangles) const;
301  void initWorkspace(bool bInside,std::vector<Triangle2*>& vWorkspace) const;
303  void bfsFromWorkspace(std::vector<Triangle2*>& vWorkspace,std::vector<Triangle2*>& vTriangles) const;
305  Zone2* ctbz_treatCC(std::vector<Triangle2*>& vOneCC);
307  void optimize(std::vector<Triangle2*>& vT,std::vector<Triangle2*>& vChangedT);
308  // Data
309  Dt2* pDt;
310  ZoneLocation zoneLoc;
311  //Zone2* pInputZone0;
312  //Zone2* pInputZone1;
313  CLASS_DECLSPEC
314  friend Zone2* zoneUnion(Zone2* pZone0,Zone2* pZone1);
315  CLASS_DECLSPEC
316  friend Zone2* zoneIntersection(Zone2* pZone0,Zone2* pZone1);
317  CLASS_DECLSPEC
318  friend Zone2* zoneDifference(Zone2* pZone0,Zone2* pZone1);
319  CLASS_DECLSPEC
320  friend Zone2* zoneSymmetricDifference(Zone2* pZone0,Zone2* pZone1);
321  CLASS_DECLSPEC
322  friend Zone2* peelOffIf(Zone2* pZone, UserPredicateT* pPredicate,bool bVerbose);
323 
324 private:
325 #ifdef _WIN32
326 #pragma warning(push)
327 #pragma warning(disable:4251)
328 #endif
329  std::vector<ConstraintGraph2*> vConstraintGraphs;
330  std::vector<Point2> vStartPoints;
331  std::vector<Zone2*> vInputZones;
332 #ifdef _WIN32
333 #pragma warning(pop)
334 #endif
335 
336 };
337 
338 // Free functions
339 
343 CLASS_DECLSPEC
344 Zone2* zoneUnion(Zone2* pZone0,Zone2* pZone1);
348 CLASS_DECLSPEC
349 Zone2* zoneIntersection(Zone2* pZone0,Zone2* pZone1);
353 CLASS_DECLSPEC
354 Zone2* zoneDifference(Zone2* pZone0,Zone2* pZone1);
359 CLASS_DECLSPEC
360 Zone2* zoneSymmetricDifference(Zone2* pZone0,Zone2* pZone1);
361 
362 
363 
364 
365 
366 } // (namespace)
Visualizer2 is a general Postscript writer. It draws the objects Point2, Segment2, Triangle2, Circle2 and Label.
Definition: Visualizer2.h:50
Zone2 is an exactly defined area of a triangulation.
Definition: Zone2.h:48
User defined predicate.
Definition: UserPredicates.h:36
ConstraintGraph2 is a set of Constraint Edges to be enforced. These are ConstraintSegment2 objects...
Definition: ConstraintGraph2.h:49
Bbox2 is an axis aligned bounding box.
Definition: Bbox2.h:36
Definition: Bbox2.h:25