Geom Software - C++ Programming and Geometry Libraries
Fade2D Documentation pages v1.52
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
47 class CLASS_DECLSPEC Zone2
48 {
49 public:
53  Zone2(Dt2* pDt_,ZoneLocation zoneLoc_);
57  Zone2(Dt2* pDt_,ZoneLocation zoneLoc_,ConstraintGraph2* pConstraintGraph_);
61  Zone2(Dt2* pDt_,ZoneLocation zoneLoc_,const std::vector<ConstraintGraph2*>& vConstraintGraphs_);
62 
66  Zone2(Dt2* pDt_,const std::vector<ConstraintGraph2*>& vConstraintGraphs_,ZoneLocation zoneLoc_,std::vector<Point2>& vStartPoints);
67 
78  ZoneLocation getZoneLocation() const;
79 
92  Zone2* convertToBoundedZone();
93 
101  void show(const std::string& postscriptFilename,bool bShowFull,bool bWithConstraints) const;
102 
110  void show(Visualizer2* pVisualizer,bool bShowFull,bool bWithConstraints) const;
111 
112 #if GEOM_PSEUDO3D==GEOM_TRUE
113 
119  void showGeomview(const std::string& filename,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 
205  bool assignDt2(Dt2* pDt_);
214  void getTriangles(std::vector<Triangle2*>& vTriangles_) const;
215 
219  void getVertices(std::vector<Point2*>& vVertices_) const;
220 
221 
226  ConstraintGraph2* getConstraintGraph() const;
227 
232  size_t getNumberOfTriangles() const;
233 
234 
238  void getConstraintGraphs(std::vector<ConstraintGraph2*>& vConstraintGraphs_) const;
239 
242  Dt2* getDelaunayTriangulation() const;
243 
248  size_t numberOfConstraintGraphs() const;
249 
252  void debug(std::string name="");
253 
256  Bbox2 getBoundingBox() const;
257 
260  void getBoundaryEdges(std::vector<Edge2>& vEdges) const;
261 
264  void getBoundarySegments(std::vector<Segment2>& vSegments) const;
265 
278  double getArea2D() const;
279 
280 
281 #if GEOM_PSEUDO3D==GEOM_TRUE
282 
289  double getArea25D() const;
290 #endif
291 
295  void getBorderEdges(std::vector<Edge2>& vBorderEdgesOut) const;
296 
297 
298 protected:
299  Zone2(const Zone2&);
300  void getTriangles_RESULT(std::vector<Triangle2*>& vTriangles) const;
301  void initWorkspace(bool bInside,std::vector<Triangle2*>& vWorkspace) const;
302  void bfsFromWorkspace(std::vector<Triangle2*>& vWorkspace,std::vector<Triangle2*>& vTriangles) const;
303 
304  Zone2* ctbz_treatCC(std::vector<Triangle2*>& vOneCC);
305  void optimize(std::vector<Triangle2*>& vT,std::vector<Triangle2*>& vChangedT);
306  // Data
307  Dt2* pDt;
308  ZoneLocation zoneLoc;
309  //Zone2* pInputZone0;
310  //Zone2* pInputZone1;
311  CLASS_DECLSPEC
312  friend Zone2* zoneUnion(Zone2* pZone0,Zone2* pZone1);
313  CLASS_DECLSPEC
314  friend Zone2* zoneIntersection(Zone2* pZone0,Zone2* pZone1);
315  CLASS_DECLSPEC
316  friend Zone2* zoneDifference(Zone2* pZone0,Zone2* pZone1);
317  CLASS_DECLSPEC
318  friend Zone2* zoneSymmetricDifference(Zone2* pZone0,Zone2* pZone1);
319  CLASS_DECLSPEC
320  friend Zone2* peelOffIf(Zone2* pZone, UserPredicateT* pPredicate,bool bVerbose);
321 
322 private:
323 #ifdef _WIN32
324 #pragma warning(push)
325 #pragma warning(disable:4251)
326 #endif
327  std::vector<ConstraintGraph2*> vConstraintGraphs;
328  std::vector<Point2> vStartPoints;
329  std::vector<Zone2*> vInputZones;
330 #ifdef _WIN32
331 #pragma warning(pop)
332 #endif
333 
334 };
335 
336 // Free functions
337 
341 CLASS_DECLSPEC
342 Zone2* zoneUnion(Zone2* pZone0,Zone2* pZone1);
346 CLASS_DECLSPEC
347 Zone2* zoneIntersection(Zone2* pZone0,Zone2* pZone1);
351 CLASS_DECLSPEC
352 Zone2* zoneDifference(Zone2* pZone0,Zone2* pZone1);
357 CLASS_DECLSPEC
358 Zone2* zoneSymmetricDifference(Zone2* pZone0,Zone2* pZone1);
359 
360 
361 
362 
363 
364 } // (namespace)
Postscript writer.
Definition: Visualizer2.h:47
Area in a triangulation.
Definition: Zone2.h:47
ConstraintGraph2 is a set of enforced edges.
Definition: ConstraintGraph2.h:47
Boundingbox.
Definition: Bbox2.h:34
Definition: Bbox2.h:25