Geom Software - C++ Programming and Geometry Libraries
Fade2D Documentation pages v1.56
Fade_2D.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 "Point2.h"
22 #include "Triangle2.h"
23 #include "TriangleAroundVertexIterator.h"
24 #include "Visualizer2.h"
25 #include "Zone2.h"
26 #include "ConstraintGraph2.h"
27 #include "Performance.h"
28 #include "MeshGenParams.h"
29 #include "MsgBase.h"
30 #include "SegmentChecker.h"
31 #include "testDataGenerators.h"
32 #include "freeFunctions.h"
33 
34 
35 
36 
37 #if GEOM_PSEUDO3D==GEOM_TRUE
38  #include "IsoContours.h"
39  #include "EfficientModel.h"
40  #include "CutAndFill.h"
41 #endif
42 
43 
44 
45 #if GEOM_PSEUDO3D==GEOM_TRUE
46  namespace GEOM_FADE25D {
47 #elif GEOM_PSEUDO3D==GEOM_FALSE
48  namespace GEOM_FADE2D {
49 #else
50  #error GEOM_PSEUDO3D is not defined
51 #endif
52 
53 
54 
55 class Dt2; // Forward
56 
57 
58 
63 class CLASS_DECLSPEC Fade_2D
64 {
65 public:
75  explicit Fade_2D(unsigned numExpectedVertices=1000)
76  {
77  initFade(numExpectedVertices);
78  }
79 
80 
81  ~Fade_2D();
82 
83 
84 
97  bool checkValidity(bool bCheckEmptyCircleProperty,const std::string& msg) const;
98 
99 
104  void statistics(const std::string& s) const;
105 
116  void show(const std::string& postscriptFilename,bool bWithConstraints=true) const;
117 
118 
131  void show(Visualizer2* pVis,bool bWithConstraints=true) const;
132 
133 #if GEOM_PSEUDO3D==GEOM_TRUE
134 
139  void showGeomview(const std::string& filename);
140 
142  // Experimental, will change
143  bool save(const char* filenameOut);
145  // Experimental, will change
146  bool load(const char* filenameIn);
147 
148 #endif
149 
156  void remove(Point2* pVertex);
157 
158 
171  void getConvexHull(bool bAllVertices,std::vector<Point2*>& vConvexHullPointsOut);
172 
173 
174 
188  Point2* insert(const Point2& p);
189 
196  void insert(const std::vector<Point2>& vInputPoints);
197 
210  void insert(const std::vector<Point2>& vInputPoints,std::vector<Point2*>& vHandles);
211 
212 #if GEOM_PSEUDO3D==GEOM_TRUE
213 
219 #else
220 
226 #endif
227  void insert(int numPoints,double * aCoordinates,Point2 ** aHandles);
228 
229 
242  void enableMultithreading();
243 
258  Triangle2* locate(const Point2& p);
259 
260 
261 #if GEOM_PSEUDO3D==GEOM_TRUE
262 
287  bool getHeight(double x,double y,double& heightOut,Triangle2* pApproxT=NULL,double tolerance=0) const;
288 #endif
289 
305  void refine( Zone2* pZone,
306  double minAngleDegree,
307  double minEdgeLength,
308  double maxEdgeLength,
309  bool bAllowConstraintSplitting
310  );
311 
320  void refineAdvanced(MeshGenParams* pParameters);
321 
322 
323 
324 
325 
326 
336  size_t numberOfPoints() const;
337 
344  size_t numberOfTriangles() const;
345 
346 
357  void getTrianglePointers(std::vector<Triangle2*>& vAllTriangles) const;
358 
370  void getVertexPointers(std::vector<Point2*>& vAllPoints) const;
371 
372 
373 
383 Triangle2* getAdjacentTriangle(Point2* p0,Point2* p1) const;
384 
402  bool is2D() const;
403 
404 
450  ConstraintGraph2* createConstraint(
451  std::vector<Segment2>& vSegments,
452  ConstraintInsertionStrategy cis,
453  bool bOrientedSegments=false
454  );
455 
456 
457 
458 
459 
460 
484  Zone2* createZone(ConstraintGraph2* pConstraintGraph,ZoneLocation zoneLoc,bool bVerbose=true);
485 
486 
498  Zone2* createZone(const std::vector<ConstraintGraph2*>& vConstraintGraphs,ZoneLocation zoneLoc,const Point2& startPoint,bool bVerbose=true);
499 
512  Zone2* createZone(ConstraintGraph2* pConstraintGraph,ZoneLocation zoneLoc,const Point2& startPoint,bool bVerbose=true);
513 
524  Zone2* createZone( std::vector<Triangle2*>& vTriangles,bool bVerbose=true );
525 
526 
527 
534  void deleteZone(Zone2* pZone);
535 
536 
552  void applyConstraintsAndZones();
553 
554 
561  Bbox2 computeBoundingBox() const;
562 
570  bool isConstraint(Triangle2* pT,int ith) const;
571 
580  ConstraintSegment2* getConstraintSegment(Point2* p0,Point2* p1) const;
581 
582 
587  void getIncidentTriangles(Point2* pVtx,std::vector<Triangle2*>& vIncidentT) const;
588 
589 
596  void writeObj(const std::string& filename) const;
597 
603  void writeObj(const std::string& filename,Zone2* pZone) const;
604 
605 
611  void writeWebScene(const char* path) const;
612 
618  void writeWebScene(const char* path,Zone2* pZone) const;
619 
625 void subscribe(MsgType msgType,MsgBase* pMsg);
626 
632 void unsubscribe(MsgType msgType,MsgBase* pMsg);
633 
634 
641  bool isConstraint(Point2* p0,Point2* p1) const;
642 
648  bool isConstraint(Point2* pVtx) const;
649 
655  void printLicense() const;
656 
662  bool checkZoneQuality(Zone2* pZone,double minAngle,const std::string& name,const AcceptExperimentalFeature& accept);
663 
669  void setName(const std::string& s);
670 
676  std::string getName() const;
677 
678 
696  Zone2* importTriangles( std::vector<Point2>& vPoints,
697  bool bReorientIfNeeded,
698  bool bCreateExtendedBoundingBox
699  );
700 
705  Orientation2 getOrientation(const Point2& p0,const Point2& p1,const Point2& p2);
706 
740  void cutTriangles( const Point2& knifeStart,
741  const Point2& knifeEnd,
742  bool bTurnEdgesIntoConstraints);
743 
756  void cutTriangles( std::vector<Segment2>& vSegments,
757  bool bTurnEdgesIntoConstraints);
758 
759 
760  // Development functions, not for public use
762  void internal(int au,int fu,std::string s="");
764  Dt2* getImpl();
766  void setDev(const std::string& s,int ival,double dval);
767 
768 protected:
770  void initFade(unsigned numExpectedVertices);
772  Fade_2D(const Fade_2D&); // No copy constructor
774  Fade_2D& operator=(const Fade_2D&); // No assignment allowed
776  Dt2* pImpl;
777 };
778 
779 
780 } // (namespace)
781 
782 
783 
784 
785 #ifndef FADE2D_EXPORT
786  #include "License.h"
787 #endif
788 
Delaunay triangulation - the main class.
Definition: Fade_2D.h:63
Fade_2D(unsigned numExpectedVertices=1000)
Constructor of the main triangulation class.
Definition: Fade_2D.h:75
Point.
Definition: Point2.h:39
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
Parameters for the mesh generator.
Definition: MeshGenParams.h:50
MsgBase
Definition: MsgBase.h:46
ConstraintGraph2 is a set of Constraint Edges to be enforced. These are ConstraintSegment2 objects...
Definition: ConstraintGraph2.h:49
A ConstraintSegment2 represents a Constraint Edge.
Definition: ConstraintSegment2.h:74
Bbox2 is an axis aligned bounding box.
Definition: Bbox2.h:36
Triangle.
Definition: Triangle2.h:48
Definition: Bbox2.h:25