Fade2D Documentation pages v2.07
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 
37 
38 
66 CLASS_DECLSPEC
68  double offset,
69  const std::vector<Point2>& vOrgPoints,
70  std::vector<Point2>& vOffsetPoints,
71  double maxCorrectionFactor=1.0
72  );
73 
74 
91 CLASS_DECLSPEC
92 int setGlobalNumCPU(int numCPU);
93 
100 CLASS_DECLSPEC
102 
103 
104 // Expects _one_ edge-connected component. No problem if the component
105 // forms a ring around a void that touches only at one vertex. But keep
106 // in mind that two completely disjoint borders may exist. This is why
107 // we use sIgnorePairs.
127 CLASS_DECLSPEC
128 void getSortedBoundaryPolygons( std::vector<Triangle2*>& vConnectedComponent,
129  std::vector<Edge2>& vOutsidePolygon,
130  std::vector<std::vector<Edge2> >& vHolePolygons
131  );
132 
133 
151 CLASS_DECLSPEC
152 void pointsToPolyline(std::vector<Point2>& vInPoints,bool bClose,std::vector<Segment2>& vOutSegments);
153 
154 
155 
164 CLASS_DECLSPEC
165 bool isSimplePolygon(std::vector<Segment2>& vSegments);
166 
167 #if GEOM_PSEUDO3D==GEOM_TRUE
179 CLASS_DECLSPEC
180 Vector2 getNormalVector( const Point2& p0,
181  const Point2& p1,
182  const Point2& p2,
183  bool& bOK);
184 #endif
185 
186 
187 
188 
189 #if GEOM_PSEUDO3D==GEOM_TRUE
199 CLASS_DECLSPEC
200 double getArea25D(const Point2* p0,const Point2* p1,const Point2* p2);
201 #endif
202 
203 
217 CLASS_DECLSPEC
218 double getArea2D(const Point2* p0,const Point2* p1,const Point2* p2);
219 
220 
226 CLASS_DECLSPEC
227 void getDirectedEdges(const std::vector<Triangle2*>& vT,std::vector<Edge2>& vDirectedEdgesOut);
228 
233 CLASS_DECLSPEC
234 void getUndirectedEdges(const std::vector<Triangle2*>& vT,std::vector<Edge2>& vUndirectedEdgesOut);
235 
246 CLASS_DECLSPEC
247 void getConnectedComponents( const std::vector<Triangle2*>& vT,
248  std::vector<std::vector<Triangle2*> >& vvT
249  );
250 
251 
275 CLASS_DECLSPEC
276 bool fillHole( const std::vector<std::pair<Segment2,Vector2> >& vPolygonSegments,
277  bool bWithRefine,
278  bool bVerbose,
279  std::vector<Point2>& vCornersOut
280  );
281 
282 
283 
284 
285 #if GEOM_PSEUDO3D==GEOM_TRUE
304 CLASS_DECLSPEC
305 bool fillHole( std::vector<Point2>& vMeshCorners,
306  const std::vector<Segment2>& vPolygonSegments,
307  bool bWithRefine,
308  bool bVerbose,
309  std::vector<Point2>& vCornersOut
310  );
311 
329 CLASS_DECLSPEC
330 bool fillHole( Mesh3* pMesh,
331  const std::vector<Edge2>& vPolygonEdges,
332  bool bWithRefine,
333  bool bVerbose,
334  std::vector<Point2>& vCornersOut
335  );
336 #endif
337 
338 
368 CLASS_DECLSPEC
370  const std::vector<Edge2>& vEdgesIn,
371  std::vector<std::vector<Edge2> >& vvPolygonsOut,
372  std::vector<Edge2>& vRemainingOut
373  );
374 
383 CLASS_DECLSPEC
384 void getBorders(const std::vector<Triangle2*>& vT,std::vector<Segment2>& vBorderSegmentsOut);
390 CLASS_DECLSPEC
391 bool sortRing(std::vector<Segment2>& vRing);
392 
393 //CLASS_DECLSPEC
394 //bool temporaryDebug(std::vector<Segment2>& vRing);
395 
402 CLASS_DECLSPEC
403 bool sortRingCCW(std::vector<Segment2>& vRing);
404 
405 
417 CLASS_DECLSPEC
418 Orientation2 getOrientation2(const Point2* p0,const Point2* p1,const Point2* p2);
426 CLASS_DECLSPEC
427 Orientation2 getOrientation2_mt(const Point2* p0,const Point2* p1,const Point2* p2);
428 
430 CLASS_DECLSPEC
431 const char* getString(const Orientation2 ori);
432 
442 CLASS_DECLSPEC
443 const char* getFade2DVersion();
446 CLASS_DECLSPEC
450 CLASS_DECLSPEC
454 CLASS_DECLSPEC
458 CLASS_DECLSPEC
459 bool isRelease();
460 
462 CLASS_DECLSPEC
463 void setLic(
464  const char* l1,
465  const char* l2,
466  const char* dt,
467  const char* s1,
468  const char* s2_
469  );
471 class Lic;
473 Lic* getLic();
474 
490 // READ AND WRITE, ASCII
492 
510 CLASS_DECLSPEC
511 bool writePointsASCII(const char* filename,const std::vector<Point2*>& vPointsIn);
512 
519 CLASS_DECLSPEC
520 bool writePointsASCII(const char* filename,const std::vector<Point2>& vPointsIn);
521 
522 
523 
524 
525 
535 CLASS_DECLSPEC
536 bool readXY(const char* filename,std::vector<Point2>& vPointsOut);
537 
538 #if GEOM_PSEUDO3D==GEOM_TRUE
539 // ONLY 2.5D
545 CLASS_DECLSPEC
546 bool readXYZ(const char* filename,std::vector<Point2>& vPointsOut);
547 #endif
548 
549 
551 // READ AND WRITE, BINARY
553 
554 
555 
577 CLASS_DECLSPEC
578 bool writePointsBIN(const char* filename,std::vector<Point2>& vPointsIn);
579 
586 CLASS_DECLSPEC
587 bool writePointsBIN(const char* filename,std::vector<Point2*>& vPointsIn);
588 
602 CLASS_DECLSPEC
603 bool readPointsBIN(const char* filename, std::vector<Point2>& vPointsIn,bool bWithHeader=true);
604 
642 CLASS_DECLSPEC
643 bool writeSegmentsBIN(const char* filename,std::vector<Segment2>& vSegmentsIn);
644 
651 CLASS_DECLSPEC
652 bool readSegmentsBIN(const char* filename,std::vector<Segment2>& vSegmentsOut);
653 
654 
655 
656 
657 
658 
660 } // NAMESPACE
Point.
Definition: Point2.h:43
Vector.
Definition: Vector2.h:42
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 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 readPointsBIN(const char *filename, std::vector< Point2 > &vPointsIn, bool bWithHeader=true)
Read points from a binary file.
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.