Panda3D
triangulator3.h
Go to the documentation of this file.
1 /**
2  * PANDA 3D SOFTWARE
3  * Copyright (c) Carnegie Mellon University. All rights reserved.
4  *
5  * All use of this software is subject to the terms of the revised BSD
6  * license. You should have received a copy of this license along
7  * with this source code in a file named "LICENSE."
8  *
9  * @file triangulator3.h
10  * @author drose
11  * @date 2013-01-03
12  */
13 
14 #ifndef TRIANGULATOR3_H
15 #define TRIANGULATOR3_H
16 
17 #include "pandabase.h"
18 #include "triangulator.h"
19 #include "plane.h"
20 
21 
22 /**
23  * This is an extension of Triangulator to handle polygons with three-
24  * dimensional points. It assumes all of the points lie in a single plane,
25  * and internally projects the supplied points into 2-D for passing to the
26  * underlying Triangulator object.
27  */
28 class EXPCL_PANDA_MATHUTIL Triangulator3 : public Triangulator {
29 PUBLISHED:
30  Triangulator3();
31 
32  void clear();
33  int add_vertex(const LPoint3d &point);
34  INLINE int add_vertex(double x, double y, double z);
35 
36  INLINE int get_num_vertices() const;
37  INLINE const LPoint3d &get_vertex(int n) const;
38  MAKE_SEQ(get_vertices, get_num_vertices, get_vertex);
39 
40  void triangulate();
41  INLINE const LPlaned &get_plane() const;
42 
43  MAKE_SEQ_PROPERTY(vertices, get_num_vertices, get_vertex);
44  MAKE_PROPERTY(plane, get_plane);
45 
46 private:
48  Vertices3 _vertices3;
49 
50  LPlaned _plane;
51 };
52 
53 #include "triangulator3.I"
54 
55 #endif
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
void triangulate()
Does the work of triangulating the specified polygon.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
This class can triangulate a convex or concave polygon, even one with holes.
Definition: triangulator.h:32
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
get_vertex
Returns the nth vertex.
Definition: triangulator.h:42
void clear()
Removes all vertices and polygon specifications from the Triangulator, and prepares it to start over.
This is an extension of Triangulator to handle polygons with three- dimensional points.
Definition: triangulator3.h:28
int add_vertex(const LPoint2d &point)
Adds a new vertex to the vertex pool.