Geom Software - C++ Programming and Geometry Libraries
Fade2D Documentation pages v1.73
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
40 class Visualizer3; // Fwd
49 class CLASS_DECLSPEC Zone2
50 {
51 public:
53  Zone2(Dt2* pDt_,ZoneLocation zoneLoc_);
55  Zone2(Dt2* pDt_,ZoneLocation zoneLoc_,ConstraintGraph2* pConstraintGraph_);
57  Zone2(Dt2* pDt_,ZoneLocation zoneLoc_,const std::vector<ConstraintGraph2*>& vConstraintGraphs_);
59  Zone2(Dt2* pDt_,const std::vector<ConstraintGraph2*>& vConstraintGraphs_,ZoneLocation zoneLoc_,std::vector<Point2>& vStartPoints);
60 
71  ZoneLocation getZoneLocation() const;
72 
85  Zone2* convertToBoundedZone();
86 
94  void show(const std::string& postscriptFilename,bool bShowFull,bool bWithConstraints) const;
95 
103  void show(Visualizer2* pVisualizer,bool bShowFull,bool bWithConstraints) const;
104 
105 #if GEOM_PSEUDO3D==GEOM_TRUE
106 
112  void showGeomview(const std::string& filename,const std::string& color) const;
119  void showGeomview(Visualizer3* pVis,const std::string& color) const;
120 #endif
121 
122 #if GEOM_PSEUDO3D==GEOM_TRUE
123 
124 
125 void analyzeAngles();
129 void slopeValleyRidgeOptimization();
130 
175  void optimizeValleysAndRidges(double tolerance2D,double lowerThreshold25D);
176 #endif
177 
200 void unifyGrid(double tolerance);
201 
203  bool assignDt2(Dt2* pDt_);
204 
216  void getTriangles(std::vector<Triangle2*>& vTriangles_) const;
217 
221  void getVertices(std::vector<Point2*>& vVertices_) const;
222 
223 
228 void statistics(const std::string& s) const;
229 
230 
235  ConstraintGraph2* getConstraintGraph() const;
236 
241  size_t getNumberOfTriangles() const;
242 
243 
247  void getConstraintGraphs(std::vector<ConstraintGraph2*>& vConstraintGraphs_) const;
248 
250  Dt2* getDelaunayTriangulation() const;
251 
256  size_t numberOfConstraintGraphs() const;
257 
260  void debug(std::string name="");
261 
264  Bbox2 getBoundingBox() const;
265 
268  void getBoundaryEdges(std::vector<Edge2>& vEdges) const;
269 
272  void getBoundarySegments(std::vector<Segment2>& vSegments) const;
273 
286  double getArea2D() const;
287 
288 
289 #if GEOM_PSEUDO3D==GEOM_TRUE
290 
297  double getArea25D() const;
298 #endif
299 
303  void getBorderEdges(std::vector<Edge2>& vBorderEdgesOut) const;
304 
305 
306 protected:
308  Zone2(const Zone2&);
310  void getTriangles_RESULT(std::vector<Triangle2*>& vTriangles) const;
312  void initWorkspace(bool bInside,std::vector<Triangle2*>& vWorkspace) const;
314  void bfsFromWorkspace(std::vector<Triangle2*>& vWorkspace,std::vector<Triangle2*>& vTriangles) const;
316  Zone2* ctbz_treatCC(std::vector<Triangle2*>& vOneCC);
318  void optimize(std::vector<Triangle2*>& vT,std::vector<Triangle2*>& vChangedT);
319  // Data
320  Dt2* pDt;
321  ZoneLocation zoneLoc;
322  //Zone2* pInputZone0;
323  //Zone2* pInputZone1;
324  CLASS_DECLSPEC
325  friend Zone2* zoneUnion(Zone2* pZone0,Zone2* pZone1);
326  CLASS_DECLSPEC
327  friend Zone2* zoneIntersection(Zone2* pZone0,Zone2* pZone1);
328  CLASS_DECLSPEC
329  friend Zone2* zoneDifference(Zone2* pZone0,Zone2* pZone1);
330  CLASS_DECLSPEC
331  friend Zone2* zoneSymmetricDifference(Zone2* pZone0,Zone2* pZone1);
332  CLASS_DECLSPEC
333  friend Zone2* peelOffIf(Zone2* pZone, UserPredicateT* pPredicate,bool bVerbose);
334 
335 private:
336 #ifdef _WIN32
337 #pragma warning(push)
338 #pragma warning(disable:4251)
339 #endif
340  std::vector<ConstraintGraph2*> vConstraintGraphs;
341  std::vector<Point2> vStartPoints;
342  std::vector<Zone2*> vInputZones;
343 #ifdef _WIN32
344 #pragma warning(pop)
345 #endif
346 
347 };
348 
349 // Free functions
350 
355 CLASS_DECLSPEC
356 Zone2* zoneUnion(Zone2* pZone0,Zone2* pZone1);
361 CLASS_DECLSPEC
362 Zone2* zoneIntersection(Zone2* pZone0,Zone2* pZone1);
367 CLASS_DECLSPEC
368 Zone2* zoneDifference(Zone2* pZone0,Zone2* pZone1);
374 CLASS_DECLSPEC
375 Zone2* zoneSymmetricDifference(Zone2* pZone0,Zone2* pZone1);
376 
377 
378 
379 
380 
381 } // (namespace)
Visualizer2 is a general Postscript writer. It draws the objects Point2, Segment2, Triangle2, Circle2 and Label.
Definition: Visualizer2.h:51
Zone2 is an exactly defined area of a triangulation.
Definition: Zone2.h:49
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