Panda3D
 All Classes Functions Variables Enumerations
eggPolygon.h
1 // Filename: eggPolygon.h
2 // Created by: drose (16Jan99)
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 EGGPOLYGON_H
16 #define EGGPOLYGON_H
17 
18 #include "pandabase.h"
19 
20 #include "eggPrimitive.h"
21 
22 ////////////////////////////////////////////////////////////////////
23 // Class : EggPolygon
24 // Description : A single polygon.
25 ////////////////////////////////////////////////////////////////////
26 class EXPCL_PANDAEGG EggPolygon : public EggPrimitive {
27 PUBLISHED:
28  INLINE EggPolygon(const string &name = "");
29  INLINE EggPolygon(const EggPolygon &copy);
30  INLINE EggPolygon &operator = (const EggPolygon &copy);
31 
32  virtual bool cleanup();
33 
34  bool calculate_normal(LNormald &result, CoordinateSystem cs = CS_default) const;
35  bool is_planar() const;
36 
37  INLINE bool recompute_polygon_normal(CoordinateSystem cs = CS_default);
38 
39  INLINE bool triangulate_into(EggGroupNode *container, bool convex_also) const;
40  PT(EggPolygon) triangulate_in_place(bool convex_also);
41 
42  virtual void write(ostream &out, int indent_level) const;
43 
44 private:
45  bool decomp_concave(EggGroupNode *container, int asum, int x, int y) const;
46  bool triangulate_poly(EggGroupNode *container, bool convex_also);
47 
48 public:
49 
50  static TypeHandle get_class_type() {
51  return _type_handle;
52  }
53  static void init_type() {
54  EggPrimitive::init_type();
55  register_type(_type_handle, "EggPolygon",
56  EggPrimitive::get_class_type());
57  }
58  virtual TypeHandle get_type() const {
59  return get_class_type();
60  }
61  virtual TypeHandle force_init_type() {init_type(); return get_class_type();}
62 
63 private:
64  static TypeHandle _type_handle;
65 
66 };
67 
68 #include "eggPolygon.I"
69 
70 #endif
A base class for any of a number of kinds of geometry primitives: polygons, point lights...
Definition: eggPrimitive.h:51
virtual bool cleanup()
Cleans up modeling errors in whatever context this makes sense.
A base class for nodes in the hierarchy that are not leaf nodes.
Definition: eggGroupNode.h:51
A single polygon.
Definition: eggPolygon.h:26
This is a three-component vector distance (as opposed to a three-component point, which represents a ...
Definition: lvector3.h:746
TypeHandle is the identifier used to differentiate C++ class types.
Definition: typeHandle.h:85