Fade2.5D Documentation pages v2.16.10
Delaunay Features
freeFunctions.h
Go to the documentation of this file.
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 // unclear to you.
14 //
15 // Support: https://www.geom.at/contact/
16 // Project: https://www.geom.at/fade2d/html/
17 
18 
20 #pragma once
21 #include "Point2.h"
22 #include "Segment2.h"
23 #include "Edge2.h"
24 #include <vector>
25 
26 
27 #if GEOM_PSEUDO3D==GEOM_TRUE
28  namespace GEOM_FADE25D {
29 #elif GEOM_PSEUDO3D==GEOM_FALSE
30  namespace GEOM_FADE2D {
31 #else
32  #error GEOM_PSEUDO3D is not defined
33 #endif
34 
35 class Mesh3; // FWD
36 class Zone2; // FWD
37 
38 
39 
56 CLASS_DECLSPEC
57 void simplifyPolygon(const std::vector<Point2>& vIn,double errBound,std::vector<Point2>& vOut);
58 
59 
60 
84 CLASS_DECLSPEC
86  double offset,
87  const std::vector<Point2>& vOrgPoints,
88  std::vector<Point2>& vOffsetPoints,
89  double maxCorrectionFactor=1.0
90  );
91 
101 CLASS_DECLSPEC
102 void untwistPolygon(std::vector<Segment2>& vPolygon,std::vector<std::vector<Segment2> >& vvPolygon);
103 
104 
105 
122 CLASS_DECLSPEC
123 int setGlobalNumCPU(int numCPU);
124 
144 CLASS_DECLSPEC
145 void setHighPrecisionIntersections(bool bUseHighPrecisionIntersections);
146 
166 CLASS_DECLSPEC
168 
177 CLASS_DECLSPEC
179 
199 CLASS_DECLSPEC
200 void getSortedBoundaryPolygons( std::vector<Triangle2*>& vConnectedComponent,
201  std::vector<Edge2>& vOutsidePolygon,
202  std::vector<std::vector<Edge2> >& vHolePolygons
203  );
204 
205 
206 
207 
220 CLASS_DECLSPEC
221 void pointsToPolyline(std::vector<Point2>& vInPoints,bool bClose,std::vector<Segment2>& vOutSegments);
222 
223 
224 
225 
237 CLASS_DECLSPEC
238 bool isSimplePolygon(std::vector<Segment2>& vSegments);
239 
240 #if GEOM_PSEUDO3D==GEOM_TRUE
241 
255 CLASS_DECLSPEC
257  const Point2& p1,
258  const Point2& p2,
259  bool& bOK);
260 #endif
261 
262 
263 
264 
265 #if GEOM_PSEUDO3D==GEOM_TRUE
266 
274 CLASS_DECLSPEC
275 double getArea25D(const Point2* p0,const Point2* p1,const Point2* p2);
276 #endif
277 
278 
291 CLASS_DECLSPEC
292 double getArea2D(const Point2* p0,const Point2* p1,const Point2* p2);
293 
294 
301 CLASS_DECLSPEC
302 void getDirectedEdges(const std::vector<Triangle2*>& vT,std::vector<Edge2>& vDirectedEdgesOut);
303 
313 CLASS_DECLSPEC
314 void getUndirectedEdges(const std::vector<Triangle2*>& vT,std::vector<Edge2>& vUndirectedEdgesOut);
315 
325 CLASS_DECLSPEC
326 void getConnectedComponents( const std::vector<Triangle2*>& vT,
327  std::vector<std::vector<Triangle2*> >& vvT
328  );
329 
330 
354 CLASS_DECLSPEC
355 bool fillHole( const std::vector<std::pair<Segment2,Vector2> >& vPolygonSegments,
356  bool bWithRefine,
357  bool bVerbose,
358  std::vector<Point2>& vCornersOut
359  );
360 
361 
362 
363 
364 #if GEOM_PSEUDO3D==GEOM_TRUE
383 CLASS_DECLSPEC
384 bool fillHole( const std::vector<Point2>& vMeshCorners,
385  const std::vector<Segment2>& vPolygonSegments,
386  bool bWithRefine,
387  bool bVerbose,
388  std::vector<Point2>& vCornersOut
389  );
390 
408 CLASS_DECLSPEC
409 bool fillHole( Mesh3* pMesh,
410  const std::vector<Edge2>& vPolygonEdges,
411  bool bWithRefine,
412  bool bVerbose,
413  std::vector<Point2>& vCornersOut
414  );
415 #endif
416 
440 CLASS_DECLSPEC
442  const std::vector<Edge2>& vEdgesIn,
443  std::vector<std::vector<Edge2> >& vvPolygonsOut,
444  std::vector<Edge2>& vRemainingOut
445  );
446 
455 CLASS_DECLSPEC
456 void getBorders(const std::vector<Triangle2*>& vT,std::vector<Segment2>& vBorderSegmentsOut);
457 
466 CLASS_DECLSPEC
467 bool sortRing(std::vector<Segment2>& vRing);
468 
480 CLASS_DECLSPEC
481 bool sortRingCCW(std::vector<Segment2>& vRing);
482 
483 
484 
500 CLASS_DECLSPEC
501 Orientation2 getOrientation2(const Point2* p0,const Point2* p1,const Point2* p2);
502 
517 CLASS_DECLSPEC
518 Orientation2 getOrientation2_mt(const Point2* p0,const Point2* p1,const Point2* p2);
519 
534 CLASS_DECLSPEC
536 
537 
538 
540 CLASS_DECLSPEC
541 const char* getString(const Orientation2 ori);
542 
563 CLASS_DECLSPEC
564 const char* getFade2DVersion();
571 CLASS_DECLSPEC
579 CLASS_DECLSPEC
587 CLASS_DECLSPEC
589 
597 CLASS_DECLSPEC
598 bool isRelease();
599 
601 CLASS_DECLSPEC
602 void setLic(
603  const char* l1,
604  const char* l2,
605  const char* dt,
606  const char* s1,
607  const char* s2_
608  );
610 class Lic;
612 Lic* getLic();
613 
629 // READ AND WRITE, ASCII
631 
655 CLASS_DECLSPEC
656 bool writePointsASCII(const char* filename,const std::vector<Point2*>& vPointsIn);
657 
670 CLASS_DECLSPEC
671 bool writePointsASCII(const char* filename,const std::vector<Point2>& vPointsIn);
672 
673 
674 
675 
676 
691 CLASS_DECLSPEC
692 bool readXY(const char* filename,std::vector<Point2>& vPointsOut);
693 
694 #if GEOM_PSEUDO3D==GEOM_TRUE
705 CLASS_DECLSPEC
706 bool readXYZ(const char* filename,std::vector<Point2>& vPointsOut);
707 #endif
708 
709 
710 
712 // READ AND WRITE, PLY
714 #ifndef SKIPTHREADS
733 CLASS_DECLSPEC
734 bool readPointsPLY(const char* filename,bool bUniquePoints,std::vector<Point2>& vPoints,std::vector<VtxColor>* pVertexColors=NULL);
735 
736 
755 CLASS_DECLSPEC
756 bool readPointsPLY(std::istream& is,bool bUniquePoints,std::vector<Point2>& vPoints,std::vector<VtxColor>* pVertexColors=NULL);
757 
768 CLASS_DECLSPEC
769 bool writePointsPLY(std::ostream& os,std::vector<Point2*>& vPoints,bool bASCII);
770 
771 
782 CLASS_DECLSPEC
783 bool writePointsPLY(const char* filename,std::vector<Point2*>& vPoints,bool bASCII);
784 
785 #endif
786 
787 
788 
790 // READ AND WRITE, BINARY
792 
793 
818 CLASS_DECLSPEC
819 bool writePointsBIN(const char* filename,std::vector<Point2>& vPoints);
820 
846 CLASS_DECLSPEC
847 bool writePointsBIN(const char* filename,std::vector<Point2*>& vPoints);
848 
849 
864 CLASS_DECLSPEC
865 bool readPointsBIN(const char* filename, std::vector<Point2>& vPoints,bool bWithHeader=true);
866 
902 CLASS_DECLSPEC
903 bool writeSegmentsBIN(const char* filename,std::vector<Segment2>& vSegmentsIn);
904 
917 CLASS_DECLSPEC
918 bool readSegmentsBIN(const char* filename,std::vector<Segment2>& vSegmentsOut);
919 
920 
921 
922 
923 
924 
926 } // NAMESPACE
CINC2
Enum for the position of a point relative to a circle.
Definition: Point2.h:34
Represents a 2.5D point.
Definition: Point2.h:76
Represents a triangle in a triangulation.
Definition: Triangle2.h:59
Vector.
Definition: Vector2.h:47
CLASS_DECLSPEC const char * getFade2DVersion()
Get the ID string.
CLASS_DECLSPEC bool isRelease()
Check if a release of debug version is used.
CLASS_DECLSPEC int getMinorVersionNumber()
Get the minor version number.
CLASS_DECLSPEC int getRevisionNumber()
Get the revision version number.
CLASS_DECLSPEC int getMajorVersionNumber()
Get the major version number.
CLASS_DECLSPEC bool readXYZ(const char *filename, std::vector< Point2 > &vPointsOut)
Read (x y z) points from an ASCII file.
CLASS_DECLSPEC bool readSegmentsBIN(const char *filename, std::vector< Segment2 > &vSegmentsOut)
Read segments from a binary file.
CLASS_DECLSPEC bool writePointsPLY(const char *filename, std::vector< Point2 * > &vPoints, bool bASCII)
Write points to a *.PLY file.
CLASS_DECLSPEC bool readPointsPLY(std::istream &is, bool bUniquePoints, std::vector< Point2 > &vPoints, std::vector< VtxColor > *pVertexColors=NULL)
Read points from a *.PLY file.
CLASS_DECLSPEC bool readXY(const char *filename, std::vector< Point2 > &vPointsOut)
Read (x y) points from an ASCII file.
CLASS_DECLSPEC bool writePointsASCII(const char *filename, const std::vector< Point2 > &vPointsIn)
Write points to an ASCII file.
CLASS_DECLSPEC bool readPointsBIN(const char *filename, std::vector< Point2 > &vPoints, bool bWithHeader=true)
Read points from a binary file.
CLASS_DECLSPEC bool writePointsBIN(const char *filename, std::vector< Point2 * > &vPoints)
Write points to a binary file.
CLASS_DECLSPEC bool writeSegmentsBIN(const char *filename, std::vector< Segment2 > &vSegmentsIn)
Write segments to a binary file.
CLASS_DECLSPEC bool isSimplePolygon(std::vector< Segment2 > &vSegments)
Check if a polygon is simple.
CLASS_DECLSPEC int setGlobalNumCPU(int numCPU)
Set the global number of threads to be used.
CLASS_DECLSPEC void getUndirectedEdges(const std::vector< Triangle2 * > &vT, std::vector< Edge2 > &vUndirectedEdgesOut)
Get undirected edges.
CLASS_DECLSPEC Orientation2 getOrientation2(const Point2 *p0, const Point2 *p1, const Point2 *p2)
Get the orientation of three points.
CLASS_DECLSPEC void getDirectedEdges(const std::vector< Triangle2 * > &vT, std::vector< Edge2 > &vDirectedEdgesOut)
Get directed edges.
CLASS_DECLSPEC void edgesToPolygons(const std::vector< Edge2 > &vEdgesIn, std::vector< std::vector< Edge2 > > &vvPolygonsOut, std::vector< Edge2 > &vRemainingOut)
Organize a set of edges into polygons.
CLASS_DECLSPEC double getArea2D(const Point2 *p0, const Point2 *p1, const Point2 *p2)
Get 2D area of a triangle.
CLASS_DECLSPEC double getArea25D(const Point2 *p0, const Point2 *p1, const Point2 *p2)
Get 2.5D area of a triangle.
CLASS_DECLSPEC void getConnectedComponents(const std::vector< Triangle2 * > &vT, std::vector< std::vector< Triangle2 * > > &vvT)
Get connected components.
CLASS_DECLSPEC void setGlobalTimeLimit_constraints(double ms)
Set a global time limit for constraint insertion.
CLASS_DECLSPEC bool sortRingCCW(std::vector< Segment2 > &vRing)
Order and orient a vector of segments (CCW)
CLASS_DECLSPEC void offsetPolygonPoints(double offset, const std::vector< Point2 > &vOrgPoints, std::vector< Point2 > &vOffsetPoints, double maxCorrectionFactor=1.0)
Get offset points (deprecated)
CLASS_DECLSPEC void pointsToPolyline(std::vector< Point2 > &vInPoints, bool bClose, std::vector< Segment2 > &vOutSegments)
Create segments from a set of points.
CLASS_DECLSPEC int getGlobalNumCPU()
Get the number of cpu cores to be used.
CLASS_DECLSPEC Vector2 getNormalVector(const Point2 &p0, const Point2 &p1, const Point2 &p2, bool &bOK)
Get the normal vector of a triangle.
CLASS_DECLSPEC void getSortedBoundaryPolygons(std::vector< Triangle2 * > &vConnectedComponent, std::vector< Edge2 > &vOutsidePolygon, std::vector< std::vector< Edge2 > > &vHolePolygons)
Get sorted boundary polygons.
CLASS_DECLSPEC void getBorders(const std::vector< Triangle2 * > &vT, std::vector< Segment2 > &vBorderSegmentsOut)
Get the border segments of a set of triangles.
CLASS_DECLSPEC void simplifyPolygon(const std::vector< Point2 > &vIn, double errBound, std::vector< Point2 > &vOut)
Simplify a polygon.
CLASS_DECLSPEC bool fillHole(Mesh3 *pMesh, const std::vector< Edge2 > &vPolygonEdges, bool bWithRefine, bool bVerbose, std::vector< Point2 > &vCornersOut)
Fill a hole in a 3D mesh with triangles (deprecated)
CLASS_DECLSPEC void untwistPolygon(std::vector< Segment2 > &vPolygon, std::vector< std::vector< Segment2 > > &vvPolygon)
Repair a selfintersecting polygon (deprecated)
CLASS_DECLSPEC bool sortRing(std::vector< Segment2 > &vRing)
Sort a vector of segments.
CLASS_DECLSPEC Orientation2 getOrientation2_mt(const Point2 *p0, const Point2 *p1, const Point2 *p2)
Get the orientation of three points (MT)
CLASS_DECLSPEC CINC2 getPointCirclePosition(Triangle2 *pT, const Point2 &q)
Check the position of a point relative to the circumcircle of a triangle.
CLASS_DECLSPEC void setHighPrecisionIntersections(bool bUseHighPrecisionIntersections)
Enable or disable high-precision intersection calculations.