Fade2D Documentation pages v2.03
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;
36 
64 CLASS_DECLSPEC
66  double offset,
67  const std::vector<Point2>& vOrgPoints,
68  std::vector<Point2>& vOffsetPoints,
69  double maxCorrectionFactor=1.0
70  );
71 
72 
89 CLASS_DECLSPEC
90 int setGlobalNumCPU(int numCPU);
91 
98 CLASS_DECLSPEC
100 
101 
102 // Expects _one_ edge-connected component. No problem if the component
103 // forms a ring around a void that touches only at one vertex. But keep
104 // in mind that two completely disjoint borders may exist. This is why
105 // we use sIgnorePairs.
125 CLASS_DECLSPEC
126 void getSortedBoundaryPolygons( std::vector<Triangle2*>& vConnectedComponent,
127  std::vector<Edge2>& vOutsidePolygon,
128  std::vector<std::vector<Edge2> >& vHolePolygons
129  );
130 
131 
149 CLASS_DECLSPEC
150 void pointsToPolyline(std::vector<Point2>& vInPoints,bool bClose,std::vector<Segment2>& vOutSegments);
151 
152 
153 
162 CLASS_DECLSPEC
163 bool isSimplePolygon(std::vector<Segment2>& vSegments);
164 
165 #if GEOM_PSEUDO3D==GEOM_TRUE
177 CLASS_DECLSPEC
178 Vector2 getNormalVector( const Point2& p0,
179  const Point2& p1,
180  const Point2& p2,
181  bool& bOK);
182 #endif
183 
184 
185 
186 
187 #if GEOM_PSEUDO3D==GEOM_TRUE
197 CLASS_DECLSPEC
198 double getArea25D(const Point2* p0,const Point2* p1,const Point2* p2);
199 #endif
200 
201 
215 CLASS_DECLSPEC
216 double getArea2D(const Point2* p0,const Point2* p1,const Point2* p2);
217 
218 
224 CLASS_DECLSPEC
225 void getDirectedEdges(const std::vector<Triangle2*>& vT,std::vector<Edge2>& vDirectedEdgesOut);
226 
231 CLASS_DECLSPEC
232 void getUndirectedEdges(const std::vector<Triangle2*>& vT,std::vector<Edge2>& vUndirectedEdgesOut);
233 
244 CLASS_DECLSPEC
245 void getConnectedComponents( const std::vector<Triangle2*>& vT,
246  std::vector<std::vector<Triangle2*> >& vvT
247  );
248 
249 
273 CLASS_DECLSPEC
274 bool fillHole( const std::vector<std::pair<Segment2,Vector2> >& vPolygonSegments,
275  bool bWithRefine,
276  bool bVerbose,
277  std::vector<Point2>& vCornersOut
278  );
279 
280 
281 
282 
283 #if GEOM_PSEUDO3D==GEOM_TRUE
302 CLASS_DECLSPEC
303 bool fillHole( std::vector<Point2>& vMeshCorners,
304  const std::vector<Segment2>& vPolygonSegments,
305  bool bWithRefine,
306  bool bVerbose,
307  std::vector<Point2>& vCornersOut
308  );
309 
327 CLASS_DECLSPEC
328 bool fillHole( Mesh3* pMesh,
329  const std::vector<Edge2>& vPolygonEdges,
330  bool bWithRefine,
331  bool bVerbose,
332  std::vector<Point2>& vCornersOut
333  );
334 #endif
335 
336 
366 CLASS_DECLSPEC
368  const std::vector<Edge2>& vEdgesIn,
369  std::vector<std::vector<Edge2> >& vvPolygonsOut,
370  std::vector<Edge2>& vRemainingOut
371  );
372 
381 CLASS_DECLSPEC
382 void getBorders(const std::vector<Triangle2*>& vT,std::vector<Segment2>& vBorderSegmentsOut);
388 CLASS_DECLSPEC
389 bool sortRing(std::vector<Segment2>& vRing);
390 
391 //CLASS_DECLSPEC
392 //bool temporaryDebug(std::vector<Segment2>& vRing);
393 
400 CLASS_DECLSPEC
401 bool sortRingCCW(std::vector<Segment2>& vRing);
402 
403 
415 CLASS_DECLSPEC
416 Orientation2 getOrientation2(const Point2* p0,const Point2* p1,const Point2* p2);
424 CLASS_DECLSPEC
425 Orientation2 getOrientation2_mt(const Point2* p0,const Point2* p1,const Point2* p2);
426 
428 CLASS_DECLSPEC
429 const char* getString(const Orientation2 ori);
430 
440 CLASS_DECLSPEC
441 const char* getFade2DVersion();
444 CLASS_DECLSPEC
448 CLASS_DECLSPEC
452 CLASS_DECLSPEC
456 CLASS_DECLSPEC
457 bool isRelease();
458 
460 CLASS_DECLSPEC
461 void setLic(
462  const char* l1,
463  const char* l2,
464  const char* dt,
465  const char* s1,
466  const char* s2_
467  );
469 class Lic;
471 Lic* getLic();
472 
488 // READ AND WRITE, ASCII
490 
508 CLASS_DECLSPEC
509 bool writePointsASCII(const char* filename,const std::vector<Point2*>& vPointsIn);
510 
517 CLASS_DECLSPEC
518 bool writePointsASCII(const char* filename,const std::vector<Point2>& vPointsIn);
519 
520 
521 
522 
523 
533 CLASS_DECLSPEC
534 bool readXY(const char* filename,std::vector<Point2>& vPointsOut);
535 
536 #if GEOM_PSEUDO3D==GEOM_TRUE
537 // ONLY 2.5D
543 CLASS_DECLSPEC
544 bool readXYZ(const char* filename,std::vector<Point2>& vPointsOut);
545 #endif
546 
547 
549 // READ AND WRITE, BINARY
551 
552 
553 
575 CLASS_DECLSPEC
576 bool writePointsBIN(const char* filename,std::vector<Point2>& vPointsIn);
577 
584 CLASS_DECLSPEC
585 bool writePointsBIN(const char* filename,std::vector<Point2*>& vPointsIn);
586 
593 CLASS_DECLSPEC
594 bool readPointsBIN(const char* filename, std::vector<Point2>& vPointsIn);
595 
633 CLASS_DECLSPEC
634 bool writeSegmentsBIN(const char* filename,std::vector<Segment2>& vSegmentsIn);
635 
642 CLASS_DECLSPEC
643 bool readSegmentsBIN(const char* filename,std::vector<Segment2>& vSegmentsOut);
644 
645 
646 
647 
648 
649 
651 } // NAMESPACE
Point.
Definition: Point2.h:43
Vector.
Definition: Vector2.h:38
void getSortedBoundaryPolygons(std::vector< Triangle2 * > &vConnectedComponent, std::vector< Edge2 > &vOutsidePolygon, std::vector< std::vector< Edge2 > > &vHolePolygons)
Get sorted boundary polygons.
void offsetPolygonPoints(double offset, const std::vector< Point2 > &vOrgPoints, std::vector< Point2 > &vOffsetPoints, double maxCorrectionFactor=1.0)
Create an offet polygon.
int setGlobalNumCPU(int numCPU)
Set the global number of threads to be used.
int getGlobalNumCPU()
Get the global number of threads to be used.
bool isRelease()
Check if a RELEASE or a DEBUG version is used.
int getMajorVersionNumber()
Get the major version number.
const char * getFade2DVersion()
Get the Fade2D version string.
int getRevisionNumber()
Get the revision version number.
int getMinorVersionNumber()
Get the minor version number.
bool writePointsASCII(const char *filename, const std::vector< Point2 > &vPointsIn)
Write points to an ASCII file.
bool readPointsBIN(const char *filename, std::vector< Point2 > &vPointsIn)
Read points from a binary file.
bool writeSegmentsBIN(const char *filename, std::vector< Segment2 > &vSegmentsIn)
Write segments to a binary file.
bool readXY(const char *filename, std::vector< Point2 > &vPointsOut)
Read (x y) points.
bool readSegmentsBIN(const char *filename, std::vector< Segment2 > &vSegmentsOut)
Read segments from a binary file.
bool writePointsBIN(const char *filename, std::vector< Point2 * > &vPointsIn)
Write points to a binary file.
Orientation2 getOrientation2(const Point2 *p0, const Point2 *p1, const Point2 *p2)
Get the orientation of three points.
void edgesToPolygons(const std::vector< Edge2 > &vEdgesIn, std::vector< std::vector< Edge2 > > &vvPolygonsOut, std::vector< Edge2 > &vRemainingOut)
Create polygons from a set of edges.
void getConnectedComponents(const std::vector< Triangle2 * > &vT, std::vector< std::vector< Triangle2 * > > &vvT)
Get connected components.
void getDirectedEdges(const std::vector< Triangle2 * > &vT, std::vector< Edge2 > &vDirectedEdgesOut)
Get directed edges The directed edges of vT are returned in vDirectedEdgesOut. Directed means that ea...
Orientation2 getOrientation2_mt(const Point2 *p0, const Point2 *p1, const Point2 *p2)
Get Orientation2 (MT)
bool isSimplePolygon(std::vector< Segment2 > &vSegments)
isSimplePolygon
void pointsToPolyline(std::vector< Point2 > &vInPoints, bool bClose, std::vector< Segment2 > &vOutSegments)
Points-to-Polyline.
bool sortRingCCW(std::vector< Segment2 > &vRing)
Sort a vector of Segments.
void getBorders(const std::vector< Triangle2 * > &vT, std::vector< Segment2 > &vBorderSegmentsOut)
Get Borders.
bool sortRing(std::vector< Segment2 > &vRing)
Sort a vector of Segments.
bool fillHole(const std::vector< std::pair< Segment2, Vector2 > > &vPolygonSegments, bool bWithRefine, bool bVerbose, std::vector< Point2 > &vCornersOut)
Fill a hole in a 3D mesh with triangles (deprecated)
double getArea2D(const Point2 *p0, const Point2 *p1, const Point2 *p2)
Get 2D area of a triangle.
void getUndirectedEdges(const std::vector< Triangle2 * > &vT, std::vector< Edge2 > &vUndirectedEdgesOut)
Get undirected edges.