Fade2D Documentation pages v1.97
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 
48 CLASS_DECLSPEC
50  double offset,
51  std::vector<Point2>& vOrgPoints,
52  std::vector<Point2>& vOffsetPoints
53  );
54 
55 
56 // Expects _one_ edge-connected component. No problem if the component
57 // forms a ring around a void that touches only at one vertex. But keep
58 // in mind that two completely disjoint borders may exist. This is why
59 // we use sIgnorePairs.
79 CLASS_DECLSPEC
80 void getSortedBoundaryPolygons( std::vector<Triangle2*>& vConnectedComponent,
81  std::vector<Edge2>& vOutsidePolygon,
82  std::vector<std::vector<Edge2> >& vHolePolygons
83  );
84 
85 
103 CLASS_DECLSPEC
104 void pointsToPolyline(std::vector<Point2>& vInPoints,bool bClose,std::vector<Segment2>& vOutSegments);
105 
106 
107 
116 CLASS_DECLSPEC
117 bool isSimplePolygon(std::vector<Segment2>& vSegments);
118 
119 #if GEOM_PSEUDO3D==GEOM_TRUE
131 CLASS_DECLSPEC
132 Vector2 getNormalVector( const Point2& p0,
133  const Point2& p1,
134  const Point2& p2,
135  bool& bOK);
136 #endif
137 
138 
139 
140 
141 #if GEOM_PSEUDO3D==GEOM_TRUE
151 CLASS_DECLSPEC
152 double getArea25D(Point2* p0,Point2* p1,Point2* p2);
153 #endif
154 
155 
169 CLASS_DECLSPEC
170 double getArea2D(Point2* p0,Point2* p1,Point2* p2);
171 
172 
178 CLASS_DECLSPEC
179 void getDirectedEdges(const std::vector<Triangle2*>& vT,std::vector<Edge2>& vDirectedEdgesOut);
180 
185 CLASS_DECLSPEC
186 void getUndirectedEdges(const std::vector<Triangle2*>& vT,std::vector<Edge2>& vUndirectedEdgesOut);
187 
198 CLASS_DECLSPEC
199 void getConnectedComponents( const std::vector<Triangle2*>& vT,
200  std::vector<std::vector<Triangle2*> >& vvT
201  );
202 
203 
227 CLASS_DECLSPEC
228 bool fillHole( std::vector<std::pair<Segment2,Vector2> > vPolygonSegments,
229  bool bWithRefine,
230  bool bVerbose,
231  std::vector<Point2>& vCornersOut
232  );
233 
234 
235 
236 
237 #if GEOM_PSEUDO3D==GEOM_TRUE
256 CLASS_DECLSPEC
257 bool fillHole( std::vector<Point2>& vMeshCorners,
258  std::vector<Segment2>& vPolygonSegments,
259  bool bWithRefine,
260  bool bVerbose,
261  std::vector<Point2>& vCornersOut
262  );
263 
281 CLASS_DECLSPEC
282 bool fillHole( Mesh3* pMesh,
283  std::vector<Edge2>& vPolygonEdges,
284  bool bWithRefine,
285  bool bVerbose,
286  std::vector<Point2>& vCornersOut
287  );
288 #endif
289 
290 
320 CLASS_DECLSPEC
322  std::vector<Edge2>& vEdgesIn,
323  std::vector<std::vector<Edge2> >& vvPolygonsOut,
324  std::vector<Edge2>& vRemainingOut
325  );
326 
335 CLASS_DECLSPEC
336 void getBorders(const std::vector<Triangle2*>& vT,std::vector<Segment2>& vBorderSegmentsOut);
342 CLASS_DECLSPEC
343 bool sortRing(std::vector<Segment2>& vRing);
344 
345 //CLASS_DECLSPEC
346 //bool temporaryDebug(std::vector<Segment2>& vRing);
347 
354 CLASS_DECLSPEC
355 bool sortRingCCW(std::vector<Segment2>& vRing);
356 
357 
369 CLASS_DECLSPEC
370 Orientation2 getOrientation2(const Point2* p0,const Point2* p1,const Point2* p2);
378 CLASS_DECLSPEC
379 Orientation2 getOrientation2_mt(const Point2* p0,const Point2* p1,const Point2* p2);
380 
382 CLASS_DECLSPEC
383 const char* getString(const Orientation2 ori);
384 
394 CLASS_DECLSPEC
395 const char* getFade2DVersion();
398 CLASS_DECLSPEC
402 CLASS_DECLSPEC
406 CLASS_DECLSPEC
410 CLASS_DECLSPEC
411 bool isRelease();
412 
414 CLASS_DECLSPEC
415 void setLic(
416  const char* l1,
417  const char* l2,
418  const char* dt,
419  const char* s1,
420  const char* s2_
421  );
423 class Lic;
425 Lic* getLic();
426 
442 // READ AND WRITE, ASCII
444 
462 CLASS_DECLSPEC
463 bool writePointsASCII(const char* filename,const std::vector<Point2*>& vPointsIn);
464 
471 CLASS_DECLSPEC
472 bool writePointsASCII(const char* filename,const std::vector<Point2>& vPointsIn);
473 
474 
475 
476 
477 
487 CLASS_DECLSPEC
488 bool readXY(const char* filename,std::vector<Point2>& vPointsOut);
489 
490 #if GEOM_PSEUDO3D==GEOM_TRUE
491 // ONLY 2.5D
497 CLASS_DECLSPEC
498 bool readXYZ(const char* filename,std::vector<Point2>& vPointsOut);
499 #endif
500 
501 
503 // READ AND WRITE, BINARY
505 
506 
507 
529 CLASS_DECLSPEC
530 bool writePointsBIN(const char* filename,std::vector<Point2>& vPointsIn);
531 
538 CLASS_DECLSPEC
539 bool writePointsBIN(const char* filename,std::vector<Point2*>& vPointsIn);
540 
547 CLASS_DECLSPEC
548 bool readPointsBIN(const char* filename, std::vector<Point2>& vPointsIn);
549 
587 CLASS_DECLSPEC
588 bool writeSegmentsBIN(const char* filename,std::vector<Segment2>& vSegmentsIn);
589 
596 CLASS_DECLSPEC
597 bool readSegmentsBIN(const char* filename,std::vector<Segment2>& vSegmentsOut);
598 
599 
600 
601 
602 
603 
605 } // 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)
Create an offet polygon.
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 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.
double getArea2D(Point2 *p0, Point2 *p1, Point2 *p2)
Get 2D area of a triangle.
bool sortRingCCW(std::vector< Segment2 > &vRing)
Sort a vector of Segments.
void edgesToPolygons(std::vector< Edge2 > &vEdgesIn, std::vector< std::vector< Edge2 > > &vvPolygonsOut, std::vector< Edge2 > &vRemainingOut)
Create polygons from a set of edges.
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(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)
void getUndirectedEdges(const std::vector< Triangle2 * > &vT, std::vector< Edge2 > &vUndirectedEdgesOut)
Get undirected edges.