ear_clip_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 ** Harry Storbacka
27 */
28 
29 
30 #pragma once
31 
32 #include "../api_core.h"
33 #include <memory>
34 #include "../Math/point.h"
35 #include <vector>
36 
37 namespace clan
38 {
41 
44 {
45 public:
46  float x1,y1,x2,y2,x3,y3;
47 };
48 
49 class EarClipTriangulator_Impl;
50 class EarClipResult;
51 
54 {
57 };
58 
61 {
64 
65 public:
68 
69  virtual ~EarClipTriangulator();
70 
74 
75 public:
77  std::vector<Pointf> get_vertices();
78 
80  int get_vertice_count();
81 
84 
88 
89 public:
91  void add_vertex(float x, float y);
92 
96  void add_vertex(const Pointf &p);
97 
99  void clear();
100 
102  void set_orientation( PolygonOrientation orientation );
103 
106 
108  void begin_hole();
109 
111  void end_hole();
112 
116 
117 private:
118  std::shared_ptr<EarClipTriangulator_Impl> impl;
120 };
121 
122 }
123 
EarClipTriangulator_Triangle.
Definition: ear_clip_triangulator.h:43
void begin_hole()
Mark beginning of a polygon hole.
float y2
Definition: ear_clip_triangulator.h:46
float x1
Definition: ear_clip_triangulator.h:46
EarClipResult triangulate()
Perform triangulation.
float x3
Definition: ear_clip_triangulator.h:46
float y1
Definition: ear_clip_triangulator.h:46
Definition: ear_clip_triangulator.h:56
void end_hole()
Mark ending of a polygon hole.
int get_vertice_count()
Returns the number of vertices in the triangulator.
PolygonOrientation
Polygon orientations.
Definition: ear_clip_triangulator.h:53
Ear-clipping triangulator.
Definition: ear_clip_triangulator.h:60
Definition: ear_clip_triangulator.h:55
void set_orientation(PolygonOrientation orientation)
Set polygon orientation.
float y3
Definition: ear_clip_triangulator.h:46
std::vector< Pointf > get_vertices()
Returns a list of the vertices added to the triangulator.
Ear clipping triangulation result structure.
Definition: ear_clip_result.h:45
void add_vertex(float x, float y)
Add the next vertex of the polygon to the triangulator.
2D (x,y) point structure - Float
Definition: point.h:73
float x2
Definition: ear_clip_triangulator.h:46
EarClipTriangulator()
Constructs a triangulator.
void clear()
Remove all vertices from triangulator.
PolygonOrientation calculate_polygon_orientation()
Determine the orientation of the vertices in the triangulator.