Geom Software - C++ Programming and Geometry Libraries
Fade2D Documentation pages v1.58
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 
159  void remove(Point2* pVertex);
160 
161 
174  void getConvexHull(bool bAllVertices,std::vector<Point2*>& vConvexHullPointsOut);
175 
176 
177 
191  Point2* insert(const Point2& p);
192 
199  void insert(const std::vector<Point2>& vInputPoints);
200 
213  void insert(const std::vector<Point2>& vInputPoints,std::vector<Point2*>& vHandles);
214 
215 #if GEOM_PSEUDO3D==GEOM_TRUE
216 
222 #else
223 
229 #endif
230  void insert(int numPoints,double * aCoordinates,Point2 ** aHandles);
231 
232 
245  void enableMultithreading();
246 
261  Triangle2* locate(const Point2& p);
262 
263 
264 #if GEOM_PSEUDO3D==GEOM_TRUE
265 
290  bool getHeight(double x,double y,double& heightOut,Triangle2* pApproxT=NULL,double tolerance=0) const;
291 #endif
292 
308  void refine( Zone2* pZone,
309  double minAngleDegree,
310  double minEdgeLength,
311  double maxEdgeLength,
312  bool bAllowConstraintSplitting
313  );
314 
323  void refineAdvanced(MeshGenParams* pParameters);
324 
325 
326 
327 
328 
329 
339  size_t numberOfPoints() const;
340 
347  size_t numberOfTriangles() const;
348 
349 
360  void getTrianglePointers(std::vector<Triangle2*>& vAllTriangles) const;
361 
373  void getVertexPointers(std::vector<Point2*>& vAllPoints) const;
374 
375 
376 
386 Triangle2* getAdjacentTriangle(Point2* p0,Point2* p1) const;
387 
405  bool is2D() const;
406 
407 
453  ConstraintGraph2* createConstraint(
454  std::vector<Segment2>& vSegments,
455  ConstraintInsertionStrategy cis,
456  bool bOrientedSegments=false
457  );
458 
459 
460 
461 
462 
463 
487  Zone2* createZone(ConstraintGraph2* pConstraintGraph,ZoneLocation zoneLoc,bool bVerbose=true);
488 
489 
501  Zone2* createZone(const std::vector<ConstraintGraph2*>& vConstraintGraphs,ZoneLocation zoneLoc,const Point2& startPoint,bool bVerbose=true);
502 
515  Zone2* createZone(ConstraintGraph2* pConstraintGraph,ZoneLocation zoneLoc,const Point2& startPoint,bool bVerbose=true);
516 
527  Zone2* createZone( std::vector<Triangle2*>& vTriangles,bool bVerbose=true );
528 
529 
530 
537  void deleteZone(Zone2* pZone);
538 
539 
555  void applyConstraintsAndZones();
556 
557 
564  Bbox2 computeBoundingBox() const;
565 
573  bool isConstraint(Triangle2* pT,int ith) const;
574 
583  ConstraintSegment2* getConstraintSegment(Point2* p0,Point2* p1) const;
584 
585 
590  void getIncidentTriangles(Point2* pVtx,std::vector<Triangle2*>& vIncidentT) const;
591 
592 
599  void writeObj(const std::string& filename) const;
600 
606  void writeObj(const std::string& filename,Zone2* pZone) const;
607 
608 
614  void writeWebScene(const char* path) const;
615 
621  void writeWebScene(const char* path,Zone2* pZone) const;
622 
628 void subscribe(MsgType msgType,MsgBase* pMsg);
629 
635 void unsubscribe(MsgType msgType,MsgBase* pMsg);
636 
637 
644  bool isConstraint(Point2* p0,Point2* p1) const;
645 
651  bool isConstraint(Point2* pVtx) const;
652 
658  void printLicense() const;
659 
665  bool checkZoneQuality(Zone2* pZone,double minAngle,const std::string& name,const AcceptExperimentalFeature& accept);
666 
672  void setName(const std::string& s);
673 
679  std::string getName() const;
680 
681 
699  Zone2* importTriangles( std::vector<Point2>& vPoints,
700  bool bReorientIfNeeded,
701  bool bCreateExtendedBoundingBox
702  );
703 
708  Orientation2 getOrientation(const Point2& p0,const Point2& p1,const Point2& p2);
709 
743  void cutTriangles( const Point2& knifeStart,
744  const Point2& knifeEnd,
745  bool bTurnEdgesIntoConstraints);
746 
759  void cutTriangles( std::vector<Segment2>& vSegments,
760  bool bTurnEdgesIntoConstraints);
761 
762 
763  // Development functions, not for public use
765  void internal(int au,int fu,std::string s="");
767  Dt2* getImpl();
769  void setDev(const std::string& s,int ival,double dval);
770 
771 protected:
773  void initFade(unsigned numExpectedVertices);
775  Fade_2D(const Fade_2D&); // No copy constructor
777  Fade_2D& operator=(const Fade_2D&); // No assignment allowed
779  Dt2* pImpl;
780 };
781 
782 
783 } // (namespace)
784 
785 
786 
787 
788 #ifndef FADE2D_EXPORT
789  #include "License.h"
790 #endif
791 
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:51
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