Fade2.5D Documentation pages v2.16.7
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 // not clear to you.
14 //
15 // Author: Bernhard Kornberger, bkorn (at) geom.at
16 // http://www.geom.at
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 
470 CLASS_DECLSPEC
471 Orientation2 getOrientation2_mt(const Point2* p0,const Point2* p1,const Point2* p2);
472 
474 CLASS_DECLSPEC
475 const char* getString(const Orientation2 ori);
476 
497 CLASS_DECLSPEC
498 const char* getFade2DVersion();
505 CLASS_DECLSPEC
513 CLASS_DECLSPEC
521 CLASS_DECLSPEC
523 
531 CLASS_DECLSPEC
532 bool isRelease();
533 
535 CLASS_DECLSPEC
536 void setLic(
537  const char* l1,
538  const char* l2,
539  const char* dt,
540  const char* s1,
541  const char* s2_
542  );
544 class Lic;
546 Lic* getLic();
547 
563 // READ AND WRITE, ASCII
565 
589 CLASS_DECLSPEC
590 bool writePointsASCII(const char* filename,const std::vector<Point2*>& vPointsIn);
591 
604 CLASS_DECLSPEC
605 bool writePointsASCII(const char* filename,const std::vector<Point2>& vPointsIn);
606 
607 
608 
609 
610 
625 CLASS_DECLSPEC
626 bool readXY(const char* filename,std::vector<Point2>& vPointsOut);
627 
628 #if GEOM_PSEUDO3D==GEOM_TRUE
639 CLASS_DECLSPEC
640 bool readXYZ(const char* filename,std::vector<Point2>& vPointsOut);
641 #endif
642 
643 
644 
646 // READ AND WRITE, PLY
648 #ifndef SKIPTHREADS
667 CLASS_DECLSPEC
668 bool readPointsPLY(const char* filename,bool bUniquePoints,std::vector<Point2>& vPoints,std::vector<VtxColor>* pVertexColors=NULL);
669 
670 
689 CLASS_DECLSPEC
690 bool readPointsPLY(std::istream& is,bool bUniquePoints,std::vector<Point2>& vPoints,std::vector<VtxColor>* pVertexColors=NULL);
691 
702 CLASS_DECLSPEC
703 bool writePointsPLY(std::ostream& os,std::vector<Point2*>& vPoints,bool bASCII);
704 
705 
716 CLASS_DECLSPEC
717 bool writePointsPLY(const char* filename,std::vector<Point2*>& vPoints,bool bASCII);
718 
719 #endif
720 
721 
722 
724 // READ AND WRITE, BINARY
726 
727 
752 CLASS_DECLSPEC
753 bool writePointsBIN(const char* filename,std::vector<Point2>& vPoints);
754 
780 CLASS_DECLSPEC
781 bool writePointsBIN(const char* filename,std::vector<Point2*>& vPoints);
782 
783 
798 CLASS_DECLSPEC
799 bool readPointsBIN(const char* filename, std::vector<Point2>& vPoints,bool bWithHeader=true);
800 
836 CLASS_DECLSPEC
837 bool writeSegmentsBIN(const char* filename,std::vector<Segment2>& vSegmentsIn);
838 
851 CLASS_DECLSPEC
852 bool readSegmentsBIN(const char* filename,std::vector<Segment2>& vSegmentsOut);
853 
854 
855 
856 
857 
858 
860 } // NAMESPACE
Represents a 2.5D point.
Definition: Point2.h:61
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)