Geom Software - C++ Programming and Geometry Libraries
Fade2.5D Documentation pages v1.63
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 
213  void getTriangles(std::vector<Triangle2*>& vTriangles_) const;
214 
218  void getVertices(std::vector<Point2*>& vVertices_) const;
219 
220 
225 void statistics(const std::string& s) const;
226 
227 
232  ConstraintGraph2* getConstraintGraph() const;
233 
238  size_t getNumberOfTriangles() const;
239 
240 
244  void getConstraintGraphs(std::vector<ConstraintGraph2*>& vConstraintGraphs_) const;
245 
247  Dt2* getDelaunayTriangulation() const;
248 
253  size_t numberOfConstraintGraphs() const;
254 
257  void debug(std::string name="");
258 
261  Bbox2 getBoundingBox() const;
262 
265  void getBoundaryEdges(std::vector<Edge2>& vEdges) const;
266 
269  void getBoundarySegments(std::vector<Segment2>& vSegments) const;
270 
283  double getArea2D() const;
284 
285 
286 #if GEOM_PSEUDO3D==GEOM_TRUE
287 
294  double getArea25D() const;
295 #endif
296 
300  void getBorderEdges(std::vector<Edge2>& vBorderEdgesOut) const;
301 
302 
303 protected:
305  Zone2(const Zone2&);
307  void getTriangles_RESULT(std::vector<Triangle2*>& vTriangles) const;
309  void initWorkspace(bool bInside,std::vector<Triangle2*>& vWorkspace) const;
311  void bfsFromWorkspace(std::vector<Triangle2*>& vWorkspace,std::vector<Triangle2*>& vTriangles) const;
313  Zone2* ctbz_treatCC(std::vector<Triangle2*>& vOneCC);
315  void optimize(std::vector<Triangle2*>& vT,std::vector<Triangle2*>& vChangedT);
316  // Data
317  Dt2* pDt;
318  ZoneLocation zoneLoc;
319  //Zone2* pInputZone0;
320  //Zone2* pInputZone1;
321  CLASS_DECLSPEC
322  friend Zone2* zoneUnion(Zone2* pZone0,Zone2* pZone1);
323  CLASS_DECLSPEC
324  friend Zone2* zoneIntersection(Zone2* pZone0,Zone2* pZone1);
325  CLASS_DECLSPEC
326  friend Zone2* zoneDifference(Zone2* pZone0,Zone2* pZone1);
327  CLASS_DECLSPEC
328  friend Zone2* zoneSymmetricDifference(Zone2* pZone0,Zone2* pZone1);
329  CLASS_DECLSPEC
330  friend Zone2* peelOffIf(Zone2* pZone, UserPredicateT* pPredicate,bool bVerbose);
331 
332 private:
333 #ifdef _WIN32
334 #pragma warning(push)
335 #pragma warning(disable:4251)
336 #endif
337  std::vector<ConstraintGraph2*> vConstraintGraphs;
338  std::vector<Point2> vStartPoints;
339  std::vector<Zone2*> vInputZones;
340 #ifdef _WIN32
341 #pragma warning(pop)
342 #endif
343 
344 };
345 
346 // Free functions
347 
352 CLASS_DECLSPEC
353 Zone2* zoneUnion(Zone2* pZone0,Zone2* pZone1);
358 CLASS_DECLSPEC
359 Zone2* zoneIntersection(Zone2* pZone0,Zone2* pZone1);
364 CLASS_DECLSPEC
365 Zone2* zoneDifference(Zone2* pZone0,Zone2* pZone1);
371 CLASS_DECLSPEC
372 Zone2* zoneSymmetricDifference(Zone2* pZone0,Zone2* pZone1);
373 
374 
375 
376 
377 
378 } // (namespace)
ConstraintGraph2 is a set of Constraint Edges to be enforced. These are ConstraintSegment2 objects...
Definition: ConstraintGraph2.h:49
Zone2 is an exactly defined area of a triangulation.
Definition: Zone2.h:49
Bbox2 is an axis aligned bounding box.
Definition: Bbox2.h:36
User defined predicate.
Definition: UserPredicates.h:36
Definition: Bbox2.h:23
Visualizer2 is a general Postscript writer. It draws the objects Point2, Segment2, Triangle2, Circle2 and Label.
Definition: Visualizer2.h:51