delauney_triangulator.h
1 /*
2 ** ClanLib SDK
3 ** Copyright (c) 1997-2015 The ClanLib Team
4 **
5 ** This software is provided 'as-is', without any express or implied
6 ** warranty. In no event will the authors be held liable for any damages
7 ** arising from the use of this software.
8 **
9 ** Permission is granted to anyone to use this software for any purpose,
10 ** including commercial applications, and to alter it and redistribute it
11 ** freely, subject to the following restrictions:
12 **
13 ** 1. The origin of this software must not be misrepresented; you must not
14 ** claim that you wrote the original software. If you use this software
15 ** in a product, an acknowledgment in the product documentation would be
16 ** appreciated but is not required.
17 ** 2. Altered source versions must be plainly marked as such, and must not be
18 ** misrepresented as being the original software.
19 ** 3. This notice may not be removed or altered from any source distribution.
20 **
21 ** Note: Some of the libraries ClanLib may link to may have additional
22 ** requirements or restrictions.
23 **
24 ** File Author(s):
25 **
26 ** Magnus Norddahl
27 */
28 
29 
30 #pragma once
31 
32 #include <memory>
33 #include <vector>
34 
35 namespace clan
36 {
39 
42 {
45 
46 public:
48  void *data;
49 
51  float x;
52 
54  float y;
56 };
57 
60 {
63 
64 public:
67 
70 
74 };
75 
76 class DelauneyTriangulator_Impl;
77 
84 {
87 
88 public:
91 
93 
97 
98 public:
100  const std::vector<DelauneyTriangulator_Vertex> &get_vertices() const;
101 
103  const std::vector<DelauneyTriangulator_Triangle> &get_triangles() const;
104 
108 
109 public:
111  void add_vertex(float x, float y, void *data);
112 
114  void generate();
115 
119 
120 private:
121  std::shared_ptr<DelauneyTriangulator_Impl> impl;
123 };
124 
125 }
126 
float x
X position of vertex.
Definition: delauney_triangulator.h:51
Vertex in the delauney triangulation.
Definition: delauney_triangulator.h:42
const std::vector< DelauneyTriangulator_Triangle > & get_triangles() const
Returns the resulting triangles produced from triangulation.
void * data
Data pointer given when adding the vertex.
Definition: delauney_triangulator.h:48
void add_vertex(float x, float y, void *data)
This function specifies a point to be used in the triangulation.
const std::vector< DelauneyTriangulator_Vertex > & get_vertices() const
Returns the list of vertices in the triangulation.
DelauneyTriangulator()
Creates a triangulator object.
DelauneyTriangulator_Vertex * vertex_A
First point in the triangle.
Definition: delauney_triangulator.h:66
Triangle generated from a delauney triangulation.
Definition: delauney_triangulator.h:60
Delauney triangulator.
Definition: delauney_triangulator.h:84
float y
Y position of vertex.
Definition: delauney_triangulator.h:54
Definition: clanapp.h:36
DelauneyTriangulator_Vertex * vertex_B
Second point in the triangle.
Definition: delauney_triangulator.h:69
DelauneyTriangulator_Vertex * vertex_C
Third point in the triangle.
Definition: delauney_triangulator.h:72
void generate()
Converts passed points into triangles.