GeoModel - GeoModelCore
Main Page
Related Pages
Classes
Files
File List
GeoModelKernel
src
PolygonTriangulator.h
1
3
// //
4
// Class: PolygonTriangulator //
5
// //
6
// Description: Triangulates any (non-complex) 2D polygon. //
7
// //
8
// Author: Thomas Kittelmann (Thomas.Kittelmann@cern.ch), March 2007 //
9
// //
10
// Notes: //
11
// //
12
// Actual algorithms are adapted from //
13
// http://www.mema.ucl.ac.be/~wu/Poly2Tri/poly2tri.html //
14
// (see copyright notice in .src file) //
15
// //
16
// Main changes performed for the present incarnation are //
17
// interface & namespace changes, indentation, small //
18
// performance tweaks and removal of unused features. //
19
// Most importantly, got rid of static and globals so the class //
20
// can be reliably used more than once per process. Also, the //
21
// output triangles are sorted to preserve "handedness". //
22
// //
24
25
26
#ifndef POLYGONTRIANGULATOR_H
27
#define POLYGONTRIANGULATOR_H
28
29
#include <vector>
30
#include <list>
31
32
class
PolygonTriangulator
{
33
public
:
34
35
typedef
std::vector<unsigned> Triangle;
36
typedef
std::list<Triangle> Triangles;
37
38
//When constructed it automatically performs the triangulation.
39
PolygonTriangulator
(
const
std::vector<double>& polygon_xcoords,
40
const
std::vector<double>& polygon_ycoords);
41
42
43
// Access the result with this
44
const
Triangles* triangles()
const
;
45
46
// Output "handedness" (clockwise or anticlockwise order) is the
47
// same for all of the triangles as it were for the input points.
48
49
//NB: If triangles().size()==0, something went wrong.
50
51
~
PolygonTriangulator
();
52
53
private
:
54
// Copying/assignment not legal:
55
PolygonTriangulator
(
const
PolygonTriangulator
& );
56
PolygonTriangulator
& operator= (
const
PolygonTriangulator
& );
57
58
class
Polygon
;
59
Polygon
* m_polygon;
60
};
61
62
#endif
PolygonTriangulator
Definition:
PolygonTriangulator.h:32
PolygonTriangulator::Polygon
Definition:
PolygonTriangulator.cxx:1441
Generated on Thu May 28 2020 05:11:08 for GeoModel - GeoModelCore by
1.8.11