Fade2D Documentation pages v2.12
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 
68 CLASS_DECLSPEC
70  double offset,
71  const std::vector<Point2>& vOrgPoints,
72  std::vector<Point2>& vOffsetPoints,
73  double maxCorrectionFactor=1.0
74  );
75 
82 CLASS_DECLSPEC
83 void untwistPolygon(std::vector<Segment2>& vPolygon,std::vector<std::vector<Segment2> >& vvPolygon);
84 
85 
102 CLASS_DECLSPEC
103 int setGlobalNumCPU(int numCPU);
104 
111 CLASS_DECLSPEC
113 
114 
115 // Expects _one_ edge-connected component. No problem if the component
116 // forms a ring around a void that touches only at one vertex. But keep
117 // in mind that two completely disjoint borders may exist. This is why
118 // we use sIgnorePairs.
138 CLASS_DECLSPEC
139 void getSortedBoundaryPolygons( std::vector<Triangle2*>& vConnectedComponent,
140  std::vector<Edge2>& vOutsidePolygon,
141  std::vector<std::vector<Edge2> >& vHolePolygons
142  );
143 
144 
162 CLASS_DECLSPEC
163 void pointsToPolyline(std::vector<Point2>& vInPoints,bool bClose,std::vector<Segment2>& vOutSegments);
164 
165 
166 
175 CLASS_DECLSPEC
176 bool isSimplePolygon(std::vector<Segment2>& vSegments);
177 
178 #if GEOM_PSEUDO3D==GEOM_TRUE
190 CLASS_DECLSPEC
191 Vector2 getNormalVector( const Point2& p0,
192  const Point2& p1,
193  const Point2& p2,
194  bool& bOK);
195 #endif
196 
197 
198 
199 
200 #if GEOM_PSEUDO3D==GEOM_TRUE
210 CLASS_DECLSPEC
211 double getArea25D(const Point2* p0,const Point2* p1,const Point2* p2);
212 #endif
213 
214 
228 CLASS_DECLSPEC
229 double getArea2D(const Point2* p0,const Point2* p1,const Point2* p2);
230 
231 
237 CLASS_DECLSPEC
238 void getDirectedEdges(const std::vector<Triangle2*>& vT,std::vector<Edge2>& vDirectedEdgesOut);
239 
244 CLASS_DECLSPEC
245 void getUndirectedEdges(const std::vector<Triangle2*>& vT,std::vector<Edge2>& vUndirectedEdgesOut);
246 
257 CLASS_DECLSPEC
258 void getConnectedComponents( const std::vector<Triangle2*>& vT,
259  std::vector<std::vector<Triangle2*> >& vvT
260  );
261 
262 
286 CLASS_DECLSPEC
287 bool fillHole( const std::vector<std::pair<Segment2,Vector2> >& vPolygonSegments,
288  bool bWithRefine,
289  bool bVerbose,
290  std::vector<Point2>& vCornersOut
291  );
292 
293 
294 
295 
296 #if GEOM_PSEUDO3D==GEOM_TRUE
315 CLASS_DECLSPEC
316 bool fillHole( const std::vector<Point2>& vMeshCorners,
317  const std::vector<Segment2>& vPolygonSegments,
318  bool bWithRefine,
319  bool bVerbose,
320  std::vector<Point2>& vCornersOut
321  );
322 
340 CLASS_DECLSPEC
341 bool fillHole( Mesh3* pMesh,
342  const std::vector<Edge2>& vPolygonEdges,
343  bool bWithRefine,
344  bool bVerbose,
345  std::vector<Point2>& vCornersOut
346  );
347 #endif
348 
349 
379 CLASS_DECLSPEC
381  const std::vector<Edge2>& vEdgesIn,
382  std::vector<std::vector<Edge2> >& vvPolygonsOut,
383  std::vector<Edge2>& vRemainingOut
384  );
385 
394 CLASS_DECLSPEC
395 void getBorders(const std::vector<Triangle2*>& vT,std::vector<Segment2>& vBorderSegmentsOut);
401 CLASS_DECLSPEC
402 bool sortRing(std::vector<Segment2>& vRing);
403 
404 //CLASS_DECLSPEC
405 //bool temporaryDebug(std::vector<Segment2>& vRing);
406 
413 CLASS_DECLSPEC
414 bool sortRingCCW(std::vector<Segment2>& vRing);
415 
416 
428 CLASS_DECLSPEC
429 Orientation2 getOrientation2(const Point2* p0,const Point2* p1,const Point2* p2);
437 CLASS_DECLSPEC
438 Orientation2 getOrientation2_mt(const Point2* p0,const Point2* p1,const Point2* p2);
439 
441 CLASS_DECLSPEC
442 const char* getString(const Orientation2 ori);
443 
453 CLASS_DECLSPEC
454 const char* getFade2DVersion();
457 CLASS_DECLSPEC
461 CLASS_DECLSPEC
465 CLASS_DECLSPEC
469 CLASS_DECLSPEC
470 bool isRelease();
471 
473 CLASS_DECLSPEC
474 void setLic(
475  const char* l1,
476  const char* l2,
477  const char* dt,
478  const char* s1,
479  const char* s2_
480  );
482 class Lic;
484 Lic* getLic();
485 
501 // READ AND WRITE, ASCII
503 
521 CLASS_DECLSPEC
522 bool writePointsASCII(const char* filename,const std::vector<Point2*>& vPointsIn);
523 
530 CLASS_DECLSPEC
531 bool writePointsASCII(const char* filename,const std::vector<Point2>& vPointsIn);
532 
533 
534 
535 
536 
546 CLASS_DECLSPEC
547 bool readXY(const char* filename,std::vector<Point2>& vPointsOut);
548 
549 #if GEOM_PSEUDO3D==GEOM_TRUE
550 // ONLY 2.5D
556 CLASS_DECLSPEC
557 bool readXYZ(const char* filename,std::vector<Point2>& vPointsOut);
558 #endif
559 
560 
561 
563 // READ AND WRITE, PLY
565 #ifndef SKIPTHREADS
577 CLASS_DECLSPEC
578 bool readPointsPLY(const char* filename,bool bUniquePoints,std::vector<Point2>& vPoints,std::vector<VtxColor>* pVertexColors=NULL);
579 
580 
593 CLASS_DECLSPEC
594 bool readPointsPLY(std::istream& is,bool bUniquePoints,std::vector<Point2>& vPoints,std::vector<VtxColor>* pVertexColors=NULL);
595 
596 
605 CLASS_DECLSPEC
606 bool writePointsPLY(std::ostream& os,std::vector<Point2*>& vPoints,bool bASCII);
607 
608 
617 CLASS_DECLSPEC
618 bool writePointsPLY(const char* filename,std::vector<Point2*>& vPoints,bool bASCII);
619 
620 #endif
621 
622 
623 
625 // READ AND WRITE, BINARY
627 
628 
629 
647 CLASS_DECLSPEC
648 bool writePointsBIN(const char* filename,std::vector<Point2>& vPoints);
649 
667 CLASS_DECLSPEC
668 bool writePointsBIN(const char* filename,std::vector<Point2*>& vPoints);
669 
683 CLASS_DECLSPEC
684 bool readPointsBIN(const char* filename, std::vector<Point2>& vPointsIn,bool bWithHeader=true);
685 
723 CLASS_DECLSPEC
724 bool writeSegmentsBIN(const char* filename,std::vector<Segment2>& vSegmentsIn);
725 
732 CLASS_DECLSPEC
733 bool readSegmentsBIN(const char* filename,std::vector<Segment2>& vSegmentsOut);
734 
735 
736 
737 
738 
739 
741 } // NAMESPACE
Point.
Definition: Point2.h:52
Vector.
Definition: Vector2.h:42
void untwistPolygon(std::vector< Segment2 > &vPolygon, std::vector< std::vector< Segment2 > > &vvPolygon)
Repair a selfintersecting polygon.
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 writePointsPLY(const char *filename, std::vector< Point2 * > &vPoints, bool bASCII)
Write points to a *.PLY file.
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 writePointsBIN(const char *filename, std::vector< Point2 * > &vPoints)
Write points to a binary file.
bool readPointsBIN(const char *filename, std::vector< Point2 > &vPointsIn, bool bWithHeader=true)
Read points from a binary file.
bool readPointsPLY(std::istream &is, bool bUniquePoints, std::vector< Point2 > &vPoints, std::vector< VtxColor > *pVertexColors=NULL)
Read points from a *.PLY file.
bool readSegmentsBIN(const char *filename, std::vector< Segment2 > &vSegmentsOut)
Read segments from 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.