Geom Software - C++ Programming and Geometry Libraries
Fade2D Documentation pages v1.52
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);
98 
99 
110  void show(const std::string& postscriptFilename,bool bWithConstraints=true) const;
111 
112 
125  void show(Visualizer2* pVis,bool bWithConstraints=true) const;
126 
127 #if GEOM_PSEUDO3D==GEOM_TRUE
128 
133  void showGeomview(const std::string& filename);
134 #endif
135 
142  void remove(Point2* pVertex);
143 
144 
157  void getConvexHull(bool bAllVertices,std::vector<Point2*>& vConvexHullPointsOut);
158 
159 
160 
174  Point2* insert(const Point2& p);
175 
182  void insert(const std::vector<Point2>& vInputPoints);
183 
196  void insert(const std::vector<Point2>& vInputPoints,std::vector<Point2*>& vHandles);
197 
198 #if GEOM_PSEUDO3D==GEOM_TRUE
199 
205 #else
206 
212 #endif
213  void insert(int numPoints,double * aCoordinates,Point2 ** aHandles);
214 
215 
228  void enableMultithreading();
229 
244  Triangle2* locate(const Point2& p);
245 
246 
247 #if GEOM_PSEUDO3D==GEOM_TRUE
248 
255  bool getHeight(double x,double y,double& height) const;
256 #endif
257 
273  void refine( Zone2* pZone,
274  double minAngleDegree,
275  double minEdgeLength,
276  double maxEdgeLength,
277  bool bAllowConstraintSplitting
278  );
279 
288  void refineAdvanced(MeshGenParams* pParameters);
289 
290 
291 
292 
293 
294 
304  size_t numberOfPoints() const;
305 
312  size_t numberOfTriangles() const;
313 
314 
325  void getTrianglePointers(std::vector<Triangle2*>& vAllTriangles) const;
326 
338  void getVertexPointers(std::vector<Point2*>& vAllPoints) const;
339 
340 
341 
351 Triangle2* getAdjacentTriangle(Point2* p0,Point2* p1) const;
352 
370  bool is2D() const;
371 
372 
418  ConstraintGraph2* createConstraint(
419  std::vector<Segment2>& vSegments,
420  ConstraintInsertionStrategy cis,
421  bool bOrientedSegments=false
422  );
423 
424 
425 
426 
427 
428 
452  Zone2* createZone(ConstraintGraph2* pConstraintGraph,ZoneLocation zoneLoc,bool bVerbose=true);
453 
454 
466  Zone2* createZone(const std::vector<ConstraintGraph2*>& vConstraintGraphs,ZoneLocation zoneLoc,const Point2& startPoint,bool bVerbose=true);
467 
480  Zone2* createZone(ConstraintGraph2* pConstraintGraph,ZoneLocation zoneLoc,const Point2& startPoint,bool bVerbose=true);
481 
492  Zone2* createZone( std::vector<Triangle2*>& vTriangles,bool bVerbose=true );
493 
494 
495 
502  void deleteZone(Zone2* pZone);
503 
504 
520  void applyConstraintsAndZones();
521 
522 
529  Bbox2 computeBoundingBox() const;
530 
538  bool isConstraint(Triangle2* pT,int ith) const;
539 
548  ConstraintSegment2* getConstraintSegment(Point2* p0,Point2* p1) const;
549 
550 
555  void getIncidentTriangles(Point2* pVtx,std::vector<Triangle2*>& vIncidentT) const;
556 
557 
564  void writeObj(const std::string& filename) const;
565 
571  void writeObj(const std::string& filename,Zone2* pZone) const;
572 
573 
579  void writeWebScene(const char* path) const;
580 
586  void writeWebScene(const char* path,Zone2* pZone) const;
587 
593 void subscribe(MsgType msgType,MsgBase* pMsg);
594 
600 void unsubscribe(MsgType msgType,MsgBase* pMsg);
601 
602 
609  bool isConstraint(Point2* p0,Point2* p1) const;
610 
616  bool isConstraint(Point2* pVtx) const;
617 
623  void printLicense() const;
624 
630  bool checkZoneQuality(Zone2* pZone,double minAngle,const std::string& name,const AcceptExperimentalFeature& accept);
631 
637  void setName(const std::string& s);
638 
644  std::string getName() const;
645 
646 
664  Zone2* importTriangles( std::vector<Point2>& vPoints,
665  bool bReorientIfNeeded,
666  bool bCreateExtendedBoundingBox
667  );
668 
673  Orientation2 getOrientation(const Point2& p0,const Point2& p1,const Point2& p2);
674 
708  void cutTriangles( const Point2& knifeStart,
709  const Point2& knifeEnd,
710  bool bTurnEdgesIntoConstraints);
711 
724  void cutTriangles( std::vector<Segment2>& vSegments,
725  bool bTurnEdgesIntoConstraints);
726 
727 
728  // Development functions, not for public use
729  void internal(int au,int fu,std::string s="");
730  Dt2* getImpl();
731 protected:
732  void initFade(unsigned numExpectedVertices);
733  Fade_2D(const Fade_2D&); // No copy constructor
734  Fade_2D& operator=(const Fade_2D&); // No assignment allowed
735  Dt2* pImpl;
736 };
737 
738 
739 } // (namespace)
740 
741 
742 
743 
744 #ifndef FADE2D_EXPORT
745  #include "License.h"
746 #endif
747 
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
Postscript writer.
Definition: Visualizer2.h:47
Area in a triangulation.
Definition: Zone2.h:47
Parameters for the mesh generator.
Definition: MeshGenParams.h:48
MsgBase
Definition: MsgBase.h:44
ConstraintGraph2 is a set of enforced edges.
Definition: ConstraintGraph2.h:47
Constraint segment.
Definition: ConstraintSegment2.h:70
Boundingbox.
Definition: Bbox2.h:34
Triangle.
Definition: Triangle2.h:48
Definition: Bbox2.h:25