Panda3D
eggNurbsCurve.h
1 // Filename: eggNurbsCurve.h
2 // Created by: drose (15Feb00)
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 EGGNURBSCURVE_H
16 #define EGGNURBSCURVE_H
17 
18 #include "pandabase.h"
19 
20 #include "eggCurve.h"
21 
22 #include "vector_double.h"
23 
24 ////////////////////////////////////////////////////////////////////
25 // Class : EggNurbsCurve
26 // Description : A parametric NURBS curve.
27 ////////////////////////////////////////////////////////////////////
28 class EXPCL_PANDAEGG EggNurbsCurve : public EggCurve {
29 PUBLISHED:
30  INLINE EggNurbsCurve(const string &name = "");
31  INLINE EggNurbsCurve(const EggNurbsCurve &copy);
32  INLINE EggNurbsCurve &operator = (const EggNurbsCurve &copy);
33 
34  void setup(int order, int num_knots);
35 
36  INLINE void set_order(int order);
37  void set_num_knots(int num);
38 
39  INLINE void set_knot(int k, double value);
40 
41  bool is_valid() const;
42 
43  INLINE int get_order() const;
44  INLINE int get_degree() const;
45  INLINE int get_num_knots() const;
46  INLINE int get_num_cvs() const;
47 
48  bool is_closed() const;
49 
50  INLINE double get_knot(int k) const;
51  MAKE_SEQ(get_knots, get_num_knots, get_knot);
52 
53  virtual void write(ostream &out, int indent_level) const;
54 
55 private:
56  typedef vector_double Knots;
57  Knots _knots;
58  int _order;
59 
60 public:
61 
62  static TypeHandle get_class_type() {
63  return _type_handle;
64  }
65  static void init_type() {
66  EggCurve::init_type();
67  register_type(_type_handle, "EggNurbsCurve",
68  EggCurve::get_class_type());
69  }
70  virtual TypeHandle get_type() const {
71  return get_class_type();
72  }
73  virtual TypeHandle force_init_type() {init_type(); return get_class_type();}
74 
75 private:
76  static TypeHandle _type_handle;
77 
78 };
79 
80 #include "eggNurbsCurve.I"
81 
82 #endif
A parametric NURBS curve.
Definition: eggNurbsCurve.h:28
A parametric curve of some kind.
Definition: eggCurve.h:27
TypeHandle is the identifier used to differentiate C++ class types.
Definition: typeHandle.h:85