Geom Software - C++ Programming and Geometry Libraries
Fade2D Documentation pages v1.55
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 #endif
141 
148  void remove(Point2* pVertex);
149 
150 
163  void getConvexHull(bool bAllVertices,std::vector<Point2*>& vConvexHullPointsOut);
164 
165 
166 
180  Point2* insert(const Point2& p);
181 
188  void insert(const std::vector<Point2>& vInputPoints);
189 
202  void insert(const std::vector<Point2>& vInputPoints,std::vector<Point2*>& vHandles);
203 
204 #if GEOM_PSEUDO3D==GEOM_TRUE
205 
211 #else
212 
218 #endif
219  void insert(int numPoints,double * aCoordinates,Point2 ** aHandles);
220 
221 
234  void enableMultithreading();
235 
250  Triangle2* locate(const Point2& p);
251 
252 
253 #if GEOM_PSEUDO3D==GEOM_TRUE
254 
279  bool getHeight(double x,double y,double& heightOut,Triangle2* pApproxT=NULL,double tolerance=0) const;
280 #endif
281 
297  void refine( Zone2* pZone,
298  double minAngleDegree,
299  double minEdgeLength,
300  double maxEdgeLength,
301  bool bAllowConstraintSplitting
302  );
303 
312  void refineAdvanced(MeshGenParams* pParameters);
313 
314 
315 
316 
317 
318 
328  size_t numberOfPoints() const;
329 
336  size_t numberOfTriangles() const;
337 
338 
349  void getTrianglePointers(std::vector<Triangle2*>& vAllTriangles) const;
350 
362  void getVertexPointers(std::vector<Point2*>& vAllPoints) const;
363 
364 
365 
375 Triangle2* getAdjacentTriangle(Point2* p0,Point2* p1) const;
376 
394  bool is2D() const;
395 
396 
442  ConstraintGraph2* createConstraint(
443  std::vector<Segment2>& vSegments,
444  ConstraintInsertionStrategy cis,
445  bool bOrientedSegments=false
446  );
447 
448 
449 
450 
451 
452 
476  Zone2* createZone(ConstraintGraph2* pConstraintGraph,ZoneLocation zoneLoc,bool bVerbose=true);
477 
478 
490  Zone2* createZone(const std::vector<ConstraintGraph2*>& vConstraintGraphs,ZoneLocation zoneLoc,const Point2& startPoint,bool bVerbose=true);
491 
504  Zone2* createZone(ConstraintGraph2* pConstraintGraph,ZoneLocation zoneLoc,const Point2& startPoint,bool bVerbose=true);
505 
516  Zone2* createZone( std::vector<Triangle2*>& vTriangles,bool bVerbose=true );
517 
518 
519 
526  void deleteZone(Zone2* pZone);
527 
528 
544  void applyConstraintsAndZones();
545 
546 
553  Bbox2 computeBoundingBox() const;
554 
562  bool isConstraint(Triangle2* pT,int ith) const;
563 
572  ConstraintSegment2* getConstraintSegment(Point2* p0,Point2* p1) const;
573 
574 
579  void getIncidentTriangles(Point2* pVtx,std::vector<Triangle2*>& vIncidentT) const;
580 
581 
588  void writeObj(const std::string& filename) const;
589 
595  void writeObj(const std::string& filename,Zone2* pZone) const;
596 
597 
603  void writeWebScene(const char* path) const;
604 
610  void writeWebScene(const char* path,Zone2* pZone) const;
611 
617 void subscribe(MsgType msgType,MsgBase* pMsg);
618 
624 void unsubscribe(MsgType msgType,MsgBase* pMsg);
625 
626 
633  bool isConstraint(Point2* p0,Point2* p1) const;
634 
640  bool isConstraint(Point2* pVtx) const;
641 
647  void printLicense() const;
648 
654  bool checkZoneQuality(Zone2* pZone,double minAngle,const std::string& name,const AcceptExperimentalFeature& accept);
655 
661  void setName(const std::string& s);
662 
668  std::string getName() const;
669 
670 
688  Zone2* importTriangles( std::vector<Point2>& vPoints,
689  bool bReorientIfNeeded,
690  bool bCreateExtendedBoundingBox
691  );
692 
697  Orientation2 getOrientation(const Point2& p0,const Point2& p1,const Point2& p2);
698 
732  void cutTriangles( const Point2& knifeStart,
733  const Point2& knifeEnd,
734  bool bTurnEdgesIntoConstraints);
735 
748  void cutTriangles( std::vector<Segment2>& vSegments,
749  bool bTurnEdgesIntoConstraints);
750 
751 
752  // Development functions, not for public use
754  void internal(int au,int fu,std::string s="");
756  Dt2* getImpl();
758  void setDev(const std::string& s,int ival,double dval);
759 
760 protected:
762  void initFade(unsigned numExpectedVertices);
764  Fade_2D(const Fade_2D&); // No copy constructor
766  Fade_2D& operator=(const Fade_2D&); // No assignment allowed
768  Dt2* pImpl;
769 };
770 
771 
772 } // (namespace)
773 
774 
775 
776 
777 #ifndef FADE2D_EXPORT
778  #include "License.h"
779 #endif
780 
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