delauney_triangulator.h Source File - ClanLib SDK
Description: delauney_triangulator.h Source File

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
40 class DelauneyTriangulator_Vertex
41 {
42 public:
44 void *data;
45
47 float x;
48
50 float y;
51 };
52
54 class DelauneyTriangulator_Triangle
55 {
56 public:
58 DelauneyTriangulator_Vertex *vertex_A;
59
61 DelauneyTriangulator_Vertex *vertex_B;
62
64 DelauneyTriangulator_Vertex *vertex_C;
65 };
66
67 class DelauneyTriangulator_Impl;
68
74 class DelauneyTriangulator
75 {
76 public:
78 DelauneyTriangulator();
79
80 virtual ~DelauneyTriangulator();
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}
clan::DelauneyTriangulator_Triangle
Triangle generated from a delauney triangulation.
Definition delauney_triangulator.h:55
clan::DelauneyTriangulator_Triangle::vertex_A
DelauneyTriangulator_Vertex * vertex_A
First point in the triangle.
Definition delauney_triangulator.h:58
clan::DelauneyTriangulator_Triangle::vertex_B
DelauneyTriangulator_Vertex * vertex_B
Second point in the triangle.
Definition delauney_triangulator.h:61
clan::DelauneyTriangulator_Triangle::vertex_C
DelauneyTriangulator_Vertex * vertex_C
Third point in the triangle.
Definition delauney_triangulator.h:64
clan::DelauneyTriangulator_Vertex
Vertex in the delauney triangulation.
Definition delauney_triangulator.h:41
clan::DelauneyTriangulator_Vertex::y
float y
Y position of vertex.
Definition delauney_triangulator.h:50
clan::DelauneyTriangulator_Vertex::data
void * data
Data pointer given when adding the vertex.
Definition delauney_triangulator.h:44
clan::DelauneyTriangulator_Vertex::x
float x
X position of vertex.
Definition delauney_triangulator.h:47
clan::DelauneyTriangulator
Delauney triangulator.
Definition delauney_triangulator.h:75
clan::DelauneyTriangulator::get_triangles
const std::vector< DelauneyTriangulator_Triangle > & get_triangles() const
Returns the resulting triangles produced from triangulation.
clan::DelauneyTriangulator::DelauneyTriangulator
DelauneyTriangulator()
Creates a triangulator object.
clan::DelauneyTriangulator::generate
void generate()
Converts passed points into triangles.
clan::DelauneyTriangulator::get_vertices
const std::vector< DelauneyTriangulator_Vertex > & get_vertices() const
Returns the list of vertices in the triangulation.
clan::DelauneyTriangulator::add_vertex
void add_vertex(float x, float y, void *data)
This function specifies a point to be used in the triangulation.
clan::DelauneyTriangulator::~DelauneyTriangulator
virtual ~DelauneyTriangulator()
clan
Definition clanapp.h:36
clan::Key::y
@ y
clan::Key::x
@ x