delauney_triangulator.h
1/*
2** ClanLib SDK
3** Copyright (c) 1997-2020 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#pragma once
30
31#include <memory>
32#include <vector>
33
34namespace clan
35{
38
41 {
42 public:
44 void *data;
45
47 float x;
48
50 float y;
51 };
52
66
67 class DelauneyTriangulator_Impl;
68
75 {
76 public:
79
81
83 const std::vector<DelauneyTriangulator_Vertex> &get_vertices() const;
84
86 const std::vector<DelauneyTriangulator_Triangle> &get_triangles() const;
87
89 void add_vertex(float x, float y, void *data);
90
92 void generate();
93
94 private:
95 std::shared_ptr<DelauneyTriangulator_Impl> impl;
96 };
97
99}
Triangle generated from a delauney triangulation.
Definition delauney_triangulator.h:55
DelauneyTriangulator_Vertex * vertex_A
First point in the triangle.
Definition delauney_triangulator.h:58
DelauneyTriangulator_Vertex * vertex_B
Second point in the triangle.
Definition delauney_triangulator.h:61
DelauneyTriangulator_Vertex * vertex_C
Third point in the triangle.
Definition delauney_triangulator.h:64
Vertex in the delauney triangulation.
Definition delauney_triangulator.h:41
float y
Y position of vertex.
Definition delauney_triangulator.h:50
void * data
Data pointer given when adding the vertex.
Definition delauney_triangulator.h:44
float x
X position of vertex.
Definition delauney_triangulator.h:47
Delauney triangulator.
Definition delauney_triangulator.h:75
const std::vector< DelauneyTriangulator_Triangle > & get_triangles() const
Returns the resulting triangles produced from triangulation.
DelauneyTriangulator()
Creates a triangulator object.
void generate()
Converts passed points into triangles.
const std::vector< DelauneyTriangulator_Vertex > & get_vertices() const
Returns the list of vertices in the triangulation.
void add_vertex(float x, float y, void *data)
This function specifies a point to be used in the triangulation.
Definition clanapp.h:36