Fade2.5D Documentation pages v2.16.8
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 
54 CLASS_DECLSPEC
55 void simplifyPolygon(const std::vector<Point2>& vIn,double errBound,std::vector<Point2>& vOut);
56 
57 
58 
82 CLASS_DECLSPEC
84  double offset,
85  const std::vector<Point2>& vOrgPoints,
86  std::vector<Point2>& vOffsetPoints,
87  double maxCorrectionFactor=1.0
88  );
89 
99 CLASS_DECLSPEC
100 void untwistPolygon(std::vector<Segment2>& vPolygon,std::vector<std::vector<Segment2> >& vvPolygon);
101 
102 
103 
120 CLASS_DECLSPEC
121 int setGlobalNumCPU(int numCPU);
122 
131 CLASS_DECLSPEC
133 
153 CLASS_DECLSPEC
154 void getSortedBoundaryPolygons( std::vector<Triangle2*>& vConnectedComponent,
155  std::vector<Edge2>& vOutsidePolygon,
156  std::vector<std::vector<Edge2> >& vHolePolygons
157  );
158 
159 
160 
161 
174 CLASS_DECLSPEC
175 void pointsToPolyline(std::vector<Point2>& vInPoints,bool bClose,std::vector<Segment2>& vOutSegments);
176 
177 
178 
179 
191 CLASS_DECLSPEC
192 bool isSimplePolygon(std::vector<Segment2>& vSegments);
193 
194 #if GEOM_PSEUDO3D==GEOM_TRUE
195 
209 CLASS_DECLSPEC
211  const Point2& p1,
212  const Point2& p2,
213  bool& bOK);
214 #endif
215 
216 
217 
218 
219 #if GEOM_PSEUDO3D==GEOM_TRUE
220 
228 CLASS_DECLSPEC
229 double getArea25D(const Point2* p0,const Point2* p1,const Point2* p2);
230 #endif
231 
232 
245 CLASS_DECLSPEC
246 double getArea2D(const Point2* p0,const Point2* p1,const Point2* p2);
247 
248 
255 CLASS_DECLSPEC
256 void getDirectedEdges(const std::vector<Triangle2*>& vT,std::vector<Edge2>& vDirectedEdgesOut);
257 
267 CLASS_DECLSPEC
268 void getUndirectedEdges(const std::vector<Triangle2*>& vT,std::vector<Edge2>& vUndirectedEdgesOut);
269 
279 CLASS_DECLSPEC
280 void getConnectedComponents( const std::vector<Triangle2*>& vT,
281  std::vector<std::vector<Triangle2*> >& vvT
282  );
283 
284 
308 CLASS_DECLSPEC
309 bool fillHole( const std::vector<std::pair<Segment2,Vector2> >& vPolygonSegments,
310  bool bWithRefine,
311  bool bVerbose,
312  std::vector<Point2>& vCornersOut
313  );
314 
315 
316 
317 
318 #if GEOM_PSEUDO3D==GEOM_TRUE
337 CLASS_DECLSPEC
338 bool fillHole( const std::vector<Point2>& vMeshCorners,
339  const std::vector<Segment2>& vPolygonSegments,
340  bool bWithRefine,
341  bool bVerbose,
342  std::vector<Point2>& vCornersOut
343  );
344 
362 CLASS_DECLSPEC
363 bool fillHole( Mesh3* pMesh,
364  const std::vector<Edge2>& vPolygonEdges,
365  bool bWithRefine,
366  bool bVerbose,
367  std::vector<Point2>& vCornersOut
368  );
369 #endif
370 
394 CLASS_DECLSPEC
396  const std::vector<Edge2>& vEdgesIn,
397  std::vector<std::vector<Edge2> >& vvPolygonsOut,
398  std::vector<Edge2>& vRemainingOut
399  );
400 
409 CLASS_DECLSPEC
410 void getBorders(const std::vector<Triangle2*>& vT,std::vector<Segment2>& vBorderSegmentsOut);
411 
420 CLASS_DECLSPEC
421 bool sortRing(std::vector<Segment2>& vRing);
422 
434 CLASS_DECLSPEC
435 bool sortRingCCW(std::vector<Segment2>& vRing);
436 
437 
438 
454 CLASS_DECLSPEC
455 Orientation2 getOrientation2(const Point2* p0,const Point2* p1,const Point2* p2);
456 
471 CLASS_DECLSPEC
472 Orientation2 getOrientation2_mt(const Point2* p0,const Point2* p1,const Point2* p2);
473 
488 CLASS_DECLSPEC
490 
491 
492 
494 CLASS_DECLSPEC
495 const char* getString(const Orientation2 ori);
496 
517 CLASS_DECLSPEC
518 const char* getFade2DVersion();
525 CLASS_DECLSPEC
533 CLASS_DECLSPEC
541 CLASS_DECLSPEC
543 
551 CLASS_DECLSPEC
552 bool isRelease();
553 
555 CLASS_DECLSPEC
556 void setLic(
557  const char* l1,
558  const char* l2,
559  const char* dt,
560  const char* s1,
561  const char* s2_
562  );
564 class Lic;
566 Lic* getLic();
567 
583 // READ AND WRITE, ASCII
585 
609 CLASS_DECLSPEC
610 bool writePointsASCII(const char* filename,const std::vector<Point2*>& vPointsIn);
611 
624 CLASS_DECLSPEC
625 bool writePointsASCII(const char* filename,const std::vector<Point2>& vPointsIn);
626 
627 
628 
629 
630 
645 CLASS_DECLSPEC
646 bool readXY(const char* filename,std::vector<Point2>& vPointsOut);
647 
648 #if GEOM_PSEUDO3D==GEOM_TRUE
659 CLASS_DECLSPEC
660 bool readXYZ(const char* filename,std::vector<Point2>& vPointsOut);
661 #endif
662 
663 
664 
666 // READ AND WRITE, PLY
668 #ifndef SKIPTHREADS
687 CLASS_DECLSPEC
688 bool readPointsPLY(const char* filename,bool bUniquePoints,std::vector<Point2>& vPoints,std::vector<VtxColor>* pVertexColors=NULL);
689 
690 
709 CLASS_DECLSPEC
710 bool readPointsPLY(std::istream& is,bool bUniquePoints,std::vector<Point2>& vPoints,std::vector<VtxColor>* pVertexColors=NULL);
711 
722 CLASS_DECLSPEC
723 bool writePointsPLY(std::ostream& os,std::vector<Point2*>& vPoints,bool bASCII);
724 
725 
736 CLASS_DECLSPEC
737 bool writePointsPLY(const char* filename,std::vector<Point2*>& vPoints,bool bASCII);
738 
739 #endif
740 
741 
742 
744 // READ AND WRITE, BINARY
746 
747 
772 CLASS_DECLSPEC
773 bool writePointsBIN(const char* filename,std::vector<Point2>& vPoints);
774 
800 CLASS_DECLSPEC
801 bool writePointsBIN(const char* filename,std::vector<Point2*>& vPoints);
802 
803 
818 CLASS_DECLSPEC
819 bool readPointsBIN(const char* filename, std::vector<Point2>& vPoints,bool bWithHeader=true);
820 
856 CLASS_DECLSPEC
857 bool writeSegmentsBIN(const char* filename,std::vector<Segment2>& vSegmentsIn);
858 
871 CLASS_DECLSPEC
872 bool readSegmentsBIN(const char* filename,std::vector<Segment2>& vSegmentsOut);
873 
874 
875 
876 
877 
878 
880 } // 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 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.