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