Panda3D
eggNurbsCurve.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 eggNurbsCurve.h
10  * @author drose
11  * @date 2000-02-15
12  */
13 
14 #ifndef EGGNURBSCURVE_H
15 #define EGGNURBSCURVE_H
16 
17 #include "pandabase.h"
18 
19 #include "eggCurve.h"
20 
21 #include "vector_double.h"
22 
23 /**
24  * A parametric NURBS curve.
25  */
26 class EXPCL_PANDA_EGG EggNurbsCurve : public EggCurve {
27 PUBLISHED:
28  INLINE explicit EggNurbsCurve(const std::string &name = "");
29  INLINE EggNurbsCurve(const EggNurbsCurve &copy);
30  INLINE EggNurbsCurve &operator = (const EggNurbsCurve &copy);
31 
32  virtual EggNurbsCurve *make_copy() const override;
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(std::ostream &out, int indent_level) const override;
54 
55  MAKE_PROPERTY(order, get_order, set_order);
56  MAKE_PROPERTY(degree, get_degree);
57  MAKE_PROPERTY(closed, is_closed);
58  MAKE_SEQ_PROPERTY(knots, get_num_knots, get_knot, set_knot);
59 
60 private:
61  typedef vector_double Knots;
62  Knots _knots;
63  int _order;
64 
65 public:
66 
67  static TypeHandle get_class_type() {
68  return _type_handle;
69  }
70  static void init_type() {
71  EggCurve::init_type();
72  register_type(_type_handle, "EggNurbsCurve",
73  EggCurve::get_class_type());
74  }
75  virtual TypeHandle get_type() const override {
76  return get_class_type();
77  }
78  virtual TypeHandle force_init_type() override {
79  init_type();
80  return get_class_type();
81  }
82 
83 private:
84  static TypeHandle _type_handle;
85 
86 };
87 
88 #include "eggNurbsCurve.I"
89 
90 #endif
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
void register_type(TypeHandle &type_handle, const std::string &name)
This inline function is just a convenient way to call TypeRegistry::register_type(),...
Definition: register_type.I:22
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
A parametric NURBS curve.
Definition: eggNurbsCurve.h:26
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
A parametric curve of some kind.
Definition: eggCurve.h:24
TypeHandle is the identifier used to differentiate C++ class types.
Definition: typeHandle.h:81