Fade2.5D Documentation pages v1.99
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  std::vector<Point2>& vOrgPoints,
68  std::vector<Point2>& vOffsetPoints,
69  double maxCorrectionFactor=1.0
70  );
71 
72 
73 // Expects _one_ edge-connected component. No problem if the component
74 // forms a ring around a void that touches only at one vertex. But keep
75 // in mind that two completely disjoint borders may exist. This is why
76 // we use sIgnorePairs.
96 CLASS_DECLSPEC
97 void getSortedBoundaryPolygons( std::vector<Triangle2*>& vConnectedComponent,
98  std::vector<Edge2>& vOutsidePolygon,
99  std::vector<std::vector<Edge2> >& vHolePolygons
100  );
101 
102 
120 CLASS_DECLSPEC
121 void pointsToPolyline(std::vector<Point2>& vInPoints,bool bClose,std::vector<Segment2>& vOutSegments);
122 
123 
124 
133 CLASS_DECLSPEC
134 bool isSimplePolygon(std::vector<Segment2>& vSegments);
135 
136 #if GEOM_PSEUDO3D==GEOM_TRUE
148 CLASS_DECLSPEC
150  const Point2& p1,
151  const Point2& p2,
152  bool& bOK);
153 #endif
154 
155 
156 
157 
158 #if GEOM_PSEUDO3D==GEOM_TRUE
168 CLASS_DECLSPEC
169 double getArea25D(Point2* p0,Point2* p1,Point2* p2);
170 #endif
171 
172 
186 CLASS_DECLSPEC
187 double getArea2D(Point2* p0,Point2* p1,Point2* p2);
188 
189 
195 CLASS_DECLSPEC
196 void getDirectedEdges(const std::vector<Triangle2*>& vT,std::vector<Edge2>& vDirectedEdgesOut);
197 
202 CLASS_DECLSPEC
203 void getUndirectedEdges(const std::vector<Triangle2*>& vT,std::vector<Edge2>& vUndirectedEdgesOut);
204 
215 CLASS_DECLSPEC
216 void getConnectedComponents( const std::vector<Triangle2*>& vT,
217  std::vector<std::vector<Triangle2*> >& vvT
218  );
219 
220 
244 CLASS_DECLSPEC
245 bool fillHole( std::vector<std::pair<Segment2,Vector2> > vPolygonSegments,
246  bool bWithRefine,
247  bool bVerbose,
248  std::vector<Point2>& vCornersOut
249  );
250 
251 
252 
253 
254 #if GEOM_PSEUDO3D==GEOM_TRUE
273 CLASS_DECLSPEC
274 bool fillHole( std::vector<Point2>& vMeshCorners,
275  std::vector<Segment2>& vPolygonSegments,
276  bool bWithRefine,
277  bool bVerbose,
278  std::vector<Point2>& vCornersOut
279  );
280 
298 CLASS_DECLSPEC
299 bool fillHole( Mesh3* pMesh,
300  std::vector<Edge2>& vPolygonEdges,
301  bool bWithRefine,
302  bool bVerbose,
303  std::vector<Point2>& vCornersOut
304  );
305 #endif
306 
307 
337 CLASS_DECLSPEC
339  std::vector<Edge2>& vEdgesIn,
340  std::vector<std::vector<Edge2> >& vvPolygonsOut,
341  std::vector<Edge2>& vRemainingOut
342  );
343 
352 CLASS_DECLSPEC
353 void getBorders(const std::vector<Triangle2*>& vT,std::vector<Segment2>& vBorderSegmentsOut);
359 CLASS_DECLSPEC
360 bool sortRing(std::vector<Segment2>& vRing);
361 
362 //CLASS_DECLSPEC
363 //bool temporaryDebug(std::vector<Segment2>& vRing);
364 
371 CLASS_DECLSPEC
372 bool sortRingCCW(std::vector<Segment2>& vRing);
373 
374 
386 CLASS_DECLSPEC
387 Orientation2 getOrientation2(const Point2* p0,const Point2* p1,const Point2* p2);
395 CLASS_DECLSPEC
396 Orientation2 getOrientation2_mt(const Point2* p0,const Point2* p1,const Point2* p2);
397 
399 CLASS_DECLSPEC
400 const char* getString(const Orientation2 ori);
401 
411 CLASS_DECLSPEC
412 const char* getFade2DVersion();
415 CLASS_DECLSPEC
419 CLASS_DECLSPEC
423 CLASS_DECLSPEC
427 CLASS_DECLSPEC
428 bool isRelease();
429 
431 CLASS_DECLSPEC
432 void setLic(
433  const char* l1,
434  const char* l2,
435  const char* dt,
436  const char* s1,
437  const char* s2_
438  );
440 class Lic;
442 Lic* getLic();
443 
459 // READ AND WRITE, ASCII
461 
479 CLASS_DECLSPEC
480 bool writePointsASCII(const char* filename,const std::vector<Point2*>& vPointsIn);
481 
488 CLASS_DECLSPEC
489 bool writePointsASCII(const char* filename,const std::vector<Point2>& vPointsIn);
490 
491 
492 
493 
494 
504 CLASS_DECLSPEC
505 bool readXY(const char* filename,std::vector<Point2>& vPointsOut);
506 
507 #if GEOM_PSEUDO3D==GEOM_TRUE
508 // ONLY 2.5D
514 CLASS_DECLSPEC
515 bool readXYZ(const char* filename,std::vector<Point2>& vPointsOut);
516 #endif
517 
518 
520 // READ AND WRITE, BINARY
522 
523 
524 
546 CLASS_DECLSPEC
547 bool writePointsBIN(const char* filename,std::vector<Point2>& vPointsIn);
548 
555 CLASS_DECLSPEC
556 bool writePointsBIN(const char* filename,std::vector<Point2*>& vPointsIn);
557 
564 CLASS_DECLSPEC
565 bool readPointsBIN(const char* filename, std::vector<Point2>& vPointsIn);
566 
604 CLASS_DECLSPEC
605 bool writeSegmentsBIN(const char* filename,std::vector<Segment2>& vSegmentsIn);
606 
613 CLASS_DECLSPEC
614 bool readSegmentsBIN(const char* filename,std::vector<Segment2>& vSegmentsOut);
615 
616 
617 
618 
619 
620 
622 } // 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, std::vector< Point2 > &vOrgPoints, std::vector< Point2 > &vOffsetPoints, double maxCorrectionFactor=1.0)
Create an offet polygon.
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)
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(Point2 *p0, Point2 *p1, Point2 *p2)
Get 2.5D area of a triangle.
double getArea2D(Point2 *p0, Point2 *p1, Point2 *p2)
Get 2D area of a triangle.
void edgesToPolygons(std::vector< Edge2 > &vEdgesIn, std::vector< std::vector< Edge2 > > &vvPolygonsOut, std::vector< Edge2 > &vRemainingOut)
Create polygons from a set of edges.
bool sortRing(std::vector< Segment2 > &vRing)
Sort a vector of Segments.
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 fillHole(Mesh3 *pMesh, std::vector< Edge2 > &vPolygonEdges, bool bWithRefine, bool bVerbose, std::vector< Point2 > &vCornersOut)
Fill a hole in a 3D mesh with triangles (deprecated)
Vector2 getNormalVector(const Point2 &p0, const Point2 &p1, const Point2 &p2, bool &bOK)
Get normal vector.
bool sortRingCCW(std::vector< Segment2 > &vRing)
Sort a vector of Segments.
void getBorders(const std::vector< Triangle2 * > &vT, std::vector< Segment2 > &vBorderSegmentsOut)
Get Borders.