Fade2.5D Documentation pages v2.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 // 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 
40 
41 
69 CLASS_DECLSPEC
71  double offset,
72  const std::vector<Point2>& vOrgPoints,
73  std::vector<Point2>& vOffsetPoints,
74  double maxCorrectionFactor=1.0
75  );
76 
83 CLASS_DECLSPEC
84 void untwistPolygon(std::vector<Segment2>& vPolygon,std::vector<std::vector<Segment2> >& vvPolygon);
85 
86 
103 CLASS_DECLSPEC
104 int setGlobalNumCPU(int numCPU);
105 
112 CLASS_DECLSPEC
114 
115 
116 // Expects _one_ edge-connected component. No problem if the component
117 // forms a ring around a void that touches only at one vertex. But keep
118 // in mind that two completely disjoint borders may exist. This is why
119 // we use sIgnorePairs.
139 CLASS_DECLSPEC
140 void getSortedBoundaryPolygons( std::vector<Triangle2*>& vConnectedComponent,
141  std::vector<Edge2>& vOutsidePolygon,
142  std::vector<std::vector<Edge2> >& vHolePolygons
143  );
144 
145 
163 CLASS_DECLSPEC
164 void pointsToPolyline(std::vector<Point2>& vInPoints,bool bClose,std::vector<Segment2>& vOutSegments);
165 
166 
167 
176 CLASS_DECLSPEC
177 bool isSimplePolygon(std::vector<Segment2>& vSegments);
178 
179 #if GEOM_PSEUDO3D==GEOM_TRUE
191 CLASS_DECLSPEC
193  const Point2& p1,
194  const Point2& p2,
195  bool& bOK);
196 #endif
197 
198 
199 
200 
201 #if GEOM_PSEUDO3D==GEOM_TRUE
211 CLASS_DECLSPEC
212 double getArea25D(const Point2* p0,const Point2* p1,const Point2* p2);
213 #endif
214 
215 
229 CLASS_DECLSPEC
230 double getArea2D(const Point2* p0,const Point2* p1,const Point2* p2);
231 
232 
238 CLASS_DECLSPEC
239 void getDirectedEdges(const std::vector<Triangle2*>& vT,std::vector<Edge2>& vDirectedEdgesOut);
240 
245 CLASS_DECLSPEC
246 void getUndirectedEdges(const std::vector<Triangle2*>& vT,std::vector<Edge2>& vUndirectedEdgesOut);
247 
258 CLASS_DECLSPEC
259 void getConnectedComponents( const std::vector<Triangle2*>& vT,
260  std::vector<std::vector<Triangle2*> >& vvT
261  );
262 
263 
287 CLASS_DECLSPEC
288 bool fillHole( const std::vector<std::pair<Segment2,Vector2> >& vPolygonSegments,
289  bool bWithRefine,
290  bool bVerbose,
291  std::vector<Point2>& vCornersOut
292  );
293 
294 
295 
296 
297 #if GEOM_PSEUDO3D==GEOM_TRUE
316 CLASS_DECLSPEC
317 bool fillHole( const std::vector<Point2>& vMeshCorners,
318  const std::vector<Segment2>& vPolygonSegments,
319  bool bWithRefine,
320  bool bVerbose,
321  std::vector<Point2>& vCornersOut
322  );
323 
341 CLASS_DECLSPEC
342 bool fillHole( Mesh3* pMesh,
343  const std::vector<Edge2>& vPolygonEdges,
344  bool bWithRefine,
345  bool bVerbose,
346  std::vector<Point2>& vCornersOut
347  );
348 #endif
349 
350 
380 CLASS_DECLSPEC
382  const std::vector<Edge2>& vEdgesIn,
383  std::vector<std::vector<Edge2> >& vvPolygonsOut,
384  std::vector<Edge2>& vRemainingOut
385  );
386 
395 CLASS_DECLSPEC
396 void getBorders(const std::vector<Triangle2*>& vT,std::vector<Segment2>& vBorderSegmentsOut);
402 CLASS_DECLSPEC
403 bool sortRing(std::vector<Segment2>& vRing);
404 
405 //CLASS_DECLSPEC
406 //bool temporaryDebug(std::vector<Segment2>& vRing);
407 
414 CLASS_DECLSPEC
415 bool sortRingCCW(std::vector<Segment2>& vRing);
416 
417 
429 CLASS_DECLSPEC
430 Orientation2 getOrientation2(const Point2* p0,const Point2* p1,const Point2* p2);
438 CLASS_DECLSPEC
439 Orientation2 getOrientation2_mt(const Point2* p0,const Point2* p1,const Point2* p2);
440 
442 CLASS_DECLSPEC
443 const char* getString(const Orientation2 ori);
444 
454 CLASS_DECLSPEC
455 const char* getFade2DVersion();
458 CLASS_DECLSPEC
462 CLASS_DECLSPEC
466 CLASS_DECLSPEC
470 CLASS_DECLSPEC
471 bool isRelease();
472 
474 CLASS_DECLSPEC
475 void setLic(
476  const char* l1,
477  const char* l2,
478  const char* dt,
479  const char* s1,
480  const char* s2_
481  );
483 class Lic;
485 Lic* getLic();
486 
502 // READ AND WRITE, ASCII
504 
522 CLASS_DECLSPEC
523 bool writePointsASCII(const char* filename,const std::vector<Point2*>& vPointsIn);
524 
531 CLASS_DECLSPEC
532 bool writePointsASCII(const char* filename,const std::vector<Point2>& vPointsIn);
533 
534 
535 
536 
537 
547 CLASS_DECLSPEC
548 bool readXY(const char* filename,std::vector<Point2>& vPointsOut);
549 
550 #if GEOM_PSEUDO3D==GEOM_TRUE
551 // ONLY 2.5D
557 CLASS_DECLSPEC
558 bool readXYZ(const char* filename,std::vector<Point2>& vPointsOut);
559 #endif
560 
561 
563 // READ AND WRITE, BINARY
565 
566 
567 
589 CLASS_DECLSPEC
590 bool writePointsBIN(const char* filename,std::vector<Point2>& vPointsIn);
591 
598 CLASS_DECLSPEC
599 bool writePointsBIN(const char* filename,std::vector<Point2*>& vPointsIn);
600 
614 CLASS_DECLSPEC
615 bool readPointsBIN(const char* filename, std::vector<Point2>& vPointsIn,bool bWithHeader=true);
616 
654 CLASS_DECLSPEC
655 bool writeSegmentsBIN(const char* filename,std::vector<Segment2>& vSegmentsIn);
656 
663 CLASS_DECLSPEC
664 bool readSegmentsBIN(const char* filename,std::vector<Segment2>& vSegmentsOut);
665 
666 
667 
668 
669 
670 
672 } // NAMESPACE
Point.
Definition: Point2.h:45
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 untwistPolygon(std::vector< Segment2 > &vPolygon, std::vector< std::vector< Segment2 > > &vvPolygon)
Repair a selfintersecting polygon.
int setGlobalNumCPU(int numCPU)
Set the global number of threads to be used.
void offsetPolygonPoints(double offset, const std::vector< Point2 > &vOrgPoints, std::vector< Point2 > &vOffsetPoints, double maxCorrectionFactor=1.0)
Create an offet polygon.
int getGlobalNumCPU()
Get the global number of threads to be used.
int getMajorVersionNumber()
Get the major version number.
const char * getFade2DVersion()
Get the Fade2D version string.
int getMinorVersionNumber()
Get the minor version number.
int getRevisionNumber()
Get the revision version number.
bool isRelease()
Check if a RELEASE or a DEBUG version is used.
bool readPointsBIN(const char *filename, std::vector< Point2 > &vPointsIn, bool bWithHeader=true)
Read points from a binary file.
bool readXY(const char *filename, std::vector< Point2 > &vPointsOut)
Read (x y) points.
bool readXYZ(const char *filename, std::vector< Point2 > &vPointsOut)
Read (x y z) points.
bool writePointsBIN(const char *filename, std::vector< Point2 * > &vPointsIn)
Write points to a binary file.
bool readSegmentsBIN(const char *filename, std::vector< Segment2 > &vSegmentsOut)
Read segments from a binary file.
bool writeSegmentsBIN(const char *filename, std::vector< Segment2 > &vSegmentsIn)
Write segments to a binary file.
bool writePointsASCII(const char *filename, const std::vector< Point2 > &vPointsIn)
Write points to an ASCII file.
bool isSimplePolygon(std::vector< Segment2 > &vSegments)
isSimplePolygon
void pointsToPolyline(std::vector< Point2 > &vInPoints, bool bClose, std::vector< Segment2 > &vOutSegments)
Points-to-Polyline.
Orientation2 getOrientation2(const Point2 *p0, const Point2 *p1, const Point2 *p2)
Get the orientation of three points.
void getConnectedComponents(const std::vector< Triangle2 * > &vT, std::vector< std::vector< Triangle2 * > > &vvT)
Get connected components.
void getUndirectedEdges(const std::vector< Triangle2 * > &vT, std::vector< Edge2 > &vUndirectedEdgesOut)
Get undirected edges.
double getArea25D(const Point2 *p0, const Point2 *p1, const Point2 *p2)
Get 2.5D area of a triangle.
bool sortRing(std::vector< Segment2 > &vRing)
Sort a vector of Segments.
double getArea2D(const Point2 *p0, const Point2 *p1, const Point2 *p2)
Get 2D area of a triangle.
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...
void edgesToPolygons(const std::vector< Edge2 > &vEdgesIn, std::vector< std::vector< Edge2 > > &vvPolygonsOut, std::vector< Edge2 > &vRemainingOut)
Create polygons from a set of edges.
Orientation2 getOrientation2_mt(const Point2 *p0, const Point2 *p1, const Point2 *p2)
Get Orientation2 (MT)
Vector2 getNormalVector(const Point2 &p0, const Point2 &p1, const Point2 &p2, bool &bOK)
Get normal vector.
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)
bool sortRingCCW(std::vector< Segment2 > &vRing)
Sort a vector of Segments.
void getBorders(const std::vector< Triangle2 * > &vT, std::vector< Segment2 > &vBorderSegmentsOut)
Get Borders.