Code_TYMPAN  4.4.0
Industrial site acoustic simulation
Triangulate.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) <2012> <EDF-R&D> <FRANCE>
3  * This program is free software; you can redistribute it and/or modify
4  * it under the terms of the GNU General Public License as published by
5  * the Free Software Foundation; either version 2 of the License, or
6  * (at your option) any later version.
7  * This program is distributed in the hope that it will be useful,
8  * but WITHOUT ANY WARRANTY; without even the implied warranty of
9  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
10  * See the GNU General Public License for more details.
11  * You should have received a copy of the GNU General Public License along
12  * with this program; if not, write to the Free Software Foundation, Inc.,
13  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
14  */
15 
16 #ifndef TRIANGULATE_H
17 
18 #define TRIANGULATE_H
19 
20 /*****************************************************************/
33 /*****************************************************************/
34 
35 #include <vector> // Include STL vector class.
36 #include "Geometry/mathlib.h"
37 
38 // Typedef an STL vector of vertices which are used to represent
39 // a polygon/contour and a series of triangles.
40 typedef std::vector<vec2> Vector2dVector;
41 
46 {
47 public:
54  static bool Process(const Vector2dVector& contour, Vector2dVector& result);
55 
57  static float Area(const Vector2dVector& contour);
58 
60  static bool InsideTriangle(float Ax, float Ay, float Bx, float By, float Cx, float Cy, float Px,
61  float Py);
62 
63 private:
64  static bool Snip(const Vector2dVector& contour, int u, int v, int w, int n, int* V);
65 };
66 
67 #endif
std::vector< vec2 > Vector2dVector
Definition: Triangulate.h:40
Triangulate a contour/polygon.
Definition: Triangulate.h:46
static bool InsideTriangle(float Ax, float Ay, float Bx, float By, float Cx, float Cy, float Px, float Py)
Decide if the point (Px,Py) is inside a triangle defined by three points (Ax,Ay) (Bx,...
Definition: Triangulate.cpp:42
static float Area(const Vector2dVector &contour)
Compute and return area of a contour/polygon.
Definition: Triangulate.cpp:24
static bool Snip(const Vector2dVector &contour, int u, int v, int w, int n, int *V)
Definition: Triangulate.cpp:70
static bool Process(const Vector2dVector &contour, Vector2dVector &result)
Triangulate a contour/polygon, places results in STL vector as series of triangles.