delauney_triangulator.h
1 /*
2 ** ClanLib SDK
3 ** Copyright (c) 1997-2013 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 "../api_core.h"
33 #include <memory>
34 #include <vector>
35 
36 namespace clan
37 {
40 
42 class CL_API_CORE DelauneyTriangulator_Vertex
43 {
46 
47 public:
49  void *data;
50 
52  float x;
53 
55  float y;
57 };
58 
61 {
64 
65 public:
68 
71 
75 };
76 
77 class DelauneyTriangulator_Impl;
78 
85 {
88 
89 public:
92 
93  virtual ~DelauneyTriangulator();
94 
98 
99 public:
101  const std::vector<DelauneyTriangulator_Vertex> &get_vertices() const;
102 
104  const std::vector<DelauneyTriangulator_Triangle> &get_triangles() const;
105 
109 
110 public:
112  void add_vertex(float x, float y, void *data);
113 
115  void generate();
116 
120 
121 private:
122  std::shared_ptr<DelauneyTriangulator_Impl> impl;
124 };
125 
126 }
127 
void add_vertex(float x, float y, void *data)
This function specifies a point to be used in the triangulation.
const std::vector< DelauneyTriangulator_Triangle > & get_triangles() const
Returns the resulting triangles produced from triangulation.
float x
X position of vertex.
Definition: delauney_triangulator.h:52
void generate()
Converts passed points into triangles.
void * data
Data pointer given when adding the vertex.
Definition: delauney_triangulator.h:49
Vertex in the delauney triangulation.
Definition: delauney_triangulator.h:42
const std::vector< DelauneyTriangulator_Vertex > & get_vertices() const
Returns the list of vertices in the triangulation.
DelauneyTriangulator_Vertex * vertex_B
Second point in the triangle.
Definition: delauney_triangulator.h:70
Delauney triangulator.
Definition: delauney_triangulator.h:84
DelauneyTriangulator_Vertex * vertex_C
Third point in the triangle.
Definition: delauney_triangulator.h:73
float y
Y position of vertex.
Definition: delauney_triangulator.h:55
Triangle generated from a delauney triangulation.
Definition: delauney_triangulator.h:60
DelauneyTriangulator()
Creates a triangulator object.
DelauneyTriangulator_Vertex * vertex_A
First point in the triangle.
Definition: delauney_triangulator.h:67