Fade2.5D Documentation pages v1.86
Delaunay Features
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"
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 #include "FadeExport.h"
34 
35 
36 #if GEOM_PSEUDO3D==GEOM_TRUE
37  #include "IsoContours.h"
38  #include "EfficientModel.h"
39  #include "CutAndFill.h"
40  #include "CloudPrepare.h"
41 #endif
42 
43 #if GEOM_PSEUDO3D==GEOM_TRUE
44  namespace GEOM_FADE25D {
45 #elif GEOM_PSEUDO3D==GEOM_FALSE
46  namespace GEOM_FADE2D {
47 #else
48  #error GEOM_PSEUDO3D is not defined
49 #endif
50 
51 
52 class Dt2; // Forward
53 class Visualizer3; // Forward
54 
55 
60 class CLASS_DECLSPEC Fade_2D
61 {
62 public:
69  explicit Fade_2D(unsigned numExpectedVertices=3)
70  {
71  initFade(numExpectedVertices);
72  }
74  ~Fade_2D();
75 
76 
77 
78 
96  bool saveTriangulation(const char* filename,std::vector<Zone2*>& vSaveZones);
97 
120  bool saveZones(const char* filename,std::vector<Zone2*>& vSaveZones);
121 
122 
132  bool load(const char* filename,std::vector<Zone2*>& vZones);
133 
134 
144  void exportTriangulation(FadeExport& fadeExport,bool bWithCustomIndices,bool bClear);
145 
146 
159  bool checkValidity(bool bCheckEmptyCircleProperty,const char* msg) const;
160 
182  int setNumCPU(int numCPU);
183 
199  void setFastMode(bool bFast);
200 
201 
206  void statistics(const char* s) const;
207 
218  void show(const char* postscriptFilename,bool bWithConstraints=true) const;
219 
220 
233  void show(Visualizer2* pVis,bool bWithConstraints=true) const;
234 
235 #if GEOM_PSEUDO3D==GEOM_TRUE
236 
243  void showGeomview(const char* filename, const char* color="1 1 1 0.5") const;
244 
252  void showGeomview(Visualizer3* pVis, const char* color="1 1 1 0.5") const;
253 
254 
255 #endif
256 
266  void remove(Point2* pVertex);
267 
268 
281  void getConvexHull(bool bAllVertices,std::vector<Point2*>& vConvexHullPointsOut);
282 
283 #if GEOM_PSEUDO3D==GEOM_TRUE
284 
301  void insert(CloudPrepare* pCloudPrepare,bool bClear=true);
302 #endif
303 
317  Point2* insert(const Point2& p);
318 
327  void insert(const std::vector<Point2>& vInputPoints);
328 
343  void insert(const std::vector<Point2>& vInputPoints,std::vector<Point2*>& vHandles);
344 
345 #if GEOM_PSEUDO3D==GEOM_TRUE
346 
354 #else
355 
363 #endif
364  void insert(int numPoints,double * aCoordinates,Point2 ** aHandles);
365 
366 
383  double measureTriangulationTime(std::vector<Point2>& vPoints);
384 
385 
386 
401  Triangle2* locate(const Point2& p);
402 
403 
404 #if GEOM_PSEUDO3D==GEOM_TRUE
405 
430  bool getHeight(double x,double y,double& heightOut,Triangle2* pApproxT=NULL,double tolerance=0) const;
431 #endif
432 
448  void refine( Zone2* pZone,
449  double minAngleDegree,
450  double minEdgeLength,
451  double maxEdgeLength,
452  bool bAllowConstraintSplitting
453  );
454 
490  void refineAdvanced(MeshGenParams* pParameters);
491 
492 
493 
494 
495 
496 
506  size_t numberOfPoints() const;
507 
514  size_t numberOfTriangles() const;
515 
516 
528  void getTrianglePointers(std::vector<Triangle2*>& vAllTriangles) const;
529 
543  void getVertexPointers(std::vector<Point2*>& vAllPoints) const;
544 
545 
546 
556 Triangle2* getAdjacentTriangle(Point2* p0,Point2* p1) const;
557 
574  bool hasArea() const;
575 
581  bool is2D() const;
582 
583 
639  ConstraintGraph2* createConstraint(
640  std::vector<Segment2>& vSegments,
642  bool bOrientedSegments=false
643  );
644 
645 
646 
647 
648 
649 
672  Zone2* createZone(ConstraintGraph2* pConstraintGraph,ZoneLocation zoneLoc,bool bVerbose=true);
673 
674 
686  Zone2* createZone(const std::vector<ConstraintGraph2*>& vConstraintGraphs,ZoneLocation zoneLoc,const Point2& startPoint,bool bVerbose=true);
687 
700  Zone2* createZone(ConstraintGraph2* pConstraintGraph,ZoneLocation zoneLoc,const Point2& startPoint,bool bVerbose=true);
701 
712  Zone2* createZone( std::vector<Triangle2*>& vTriangles,bool bVerbose=true );
713 
714 
715 
728  void deleteZone(Zone2* pZone);
729 
730 
750  void applyConstraintsAndZones();
751 
752 
759  Bbox2 computeBoundingBox() const;
760 
768  bool isConstraint(Triangle2* pT,int ith) const;
769 
772  void getAliveConstraintSegments(std::vector<ConstraintSegment2*>& vAliveConstraintSegments) const;
773 
776  void getAliveAndDeadConstraintSegments(std::vector<ConstraintSegment2*>& vAllConstraintSegments) const;
777 
785  ConstraintSegment2* getConstraintSegment(Point2* p0,Point2* p1) const;
786 
787 
792  void getIncidentTriangles(Point2* pVtx,std::vector<Triangle2*>& vIncidentT) const;
793 
798  void getIncidentVertices(Point2* pVtx,std::vector<Point2*>& vIncidentVertices) const;
799 
800 
808  void writeObj(const char* filename) const;
809 
816  void writeObj(const char* filename,Zone2* pZone) const;
817 
818 
824  void writeWebScene(const char* path) const;
825 
831  void writeWebScene(const char* path,Zone2* pZone) const;
832 
838 void subscribe(MsgType msgType,MsgBase* pMsg);
839 
845 void unsubscribe(MsgType msgType,MsgBase* pMsg);
846 
847 
854  bool isConstraint(Point2* p0,Point2* p1) const;
855 
861  bool isConstraint(Point2* pVtx) const;
862 
864  void printLicense() const;
865 
867  bool checkZoneQuality(Zone2* pZone,double minAngle,const char* name,const AcceptExperimentalFeature& accept);
869  void setName(const char* s);
871  const char* getName() const;
872 
873 
895  Zone2* importTriangles( std::vector<Point2>& vPoints,
896  bool bReorientIfNeeded,
897  bool bCreateExtendedBoundingBox
898  );
899 
904  Orientation2 getOrientation(const Point2& p0,const Point2& p1,const Point2& p2);
905 
936  void cutTriangles( const Point2& knifeStart,
937  const Point2& knifeEnd,
938  bool bTurnEdgesIntoConstraints);
939 
952  void cutTriangles( std::vector<Segment2>& vSegments,
953  bool bTurnEdgesIntoConstraints);
954 
955 
975 Zone2* createZone_cookieCutter(std::vector<Segment2>& vSegments,bool bProtectEdges);
976 
977 
1023 #if GEOM_PSEUDO3D==GEOM_TRUE
1024 bool drape( std::vector<Segment2>& vSegmentsIn,
1025  std::vector<Segment2>& vSegmentsOut,
1026  double zTolerance) const;
1027 #else
1028 bool drape( std::vector<Segment2>& vSegmentsIn,
1029  std::vector<Segment2>& vSegmentsOut) const;
1030 #endif
1031 
1032 
1040  void enableMultithreading();
1041 
1042  // Development functions, not for public use
1044  void internal(int au,int fu,const char* s="");
1046  Dt2* getImpl();
1048  void setDev(const char* s,int ival,double dval);
1049 
1050 protected:
1052  void initFade(unsigned numExpectedVertices);
1054  Fade_2D(const Fade_2D&); // No copy constructor
1056  Fade_2D& operator=(const Fade_2D&); // No assignment allowed
1058  Dt2* pImpl;
1059 };
1060 
1061 
1062 } // (namespace)
1063 
1064 
1065 
1066 
1067 #ifndef FADE2D_EXPORT
1068  #include "License.h"
1069 #endif
1070 
GEOM_FADE25D::ConstraintGraph2
ConstraintGraph2 is a set of Constraint Edges (ConstraintSegment2)
Definition: ConstraintGraph2.h:50
GEOM_FADE25D::MsgBase
MsgBase, a base class for message subscriber classes.
Definition: MsgBase.h:45
CloudPrepare.h
GEOM_FADE25D::FadeExport
FadeExport is a simple struct to export triangulation data.
Definition: FadeExport.h:41
GEOM_FADE25D::Visualizer3
Visualizer3 is a 3D scene writer for the Geomview viewer.
Definition: Visualizer3.h:34
GEOM_FADE25D::ConstraintInsertionStrategy
ConstraintInsertionStrategy
Constraint Insertion Strategy determines how a constraint edge shall be inserted:
Definition: ConstraintSegment2.h:51
TriangleAroundVertexIterator.h
EfficientModel.h
GEOM_FADE25D::Triangle2
Triangle.
Definition: Triangle2.h:48
GEOM_FADE25D::Visualizer2
Visualizer2 is a general Postscript writer. It draws the objects Point2, Segment2,...
Definition: Visualizer2.h:54
GEOM_FADE25D::ConstraintSegment2
A ConstraintSegment2 represents a Constraint Edge.
Definition: ConstraintSegment2.h:68
GEOM_FADE25D::CloudPrepare
CloudPrepare simplifies overdense point clouds and helps to avoid memory-usage-peaks during data tran...
Definition: CloudPrepare.h:86
GEOM_FADE25D::Point2
Point.
Definition: Point2.h:40
GEOM_FADE25D::Fade_2D::Fade_2D
Fade_2D(unsigned numExpectedVertices=3)
Constructor of the main triangulation class.
Definition: Fade_2D.h:69
GEOM_FADE25D::Zone2
Zone2 is a certain defined area of a triangulation.
Definition: Zone2.h:60
GEOM_FADE25D::Fade_2D
Fade_2D is the Delaunay triangulation main class.
Definition: Fade_2D.h:60
GEOM_FADE25D::Bbox2
Bbox2 is an axis aligned 2D bounding box.
Definition: Bbox2.h:36
GEOM_FADE25D::MeshGenParams
Parameters for the mesh generator.
Definition: MeshGenParams.h:51
SegmentChecker.h