Panda3D

eggNurbsCurve.h

00001 // Filename: eggNurbsCurve.h
00002 // Created by:  drose (15Feb00)
00003 //
00004 ////////////////////////////////////////////////////////////////////
00005 //
00006 // PANDA 3D SOFTWARE
00007 // Copyright (c) Carnegie Mellon University.  All rights reserved.
00008 //
00009 // All use of this software is subject to the terms of the revised BSD
00010 // license.  You should have received a copy of this license along
00011 // with this source code in a file named "LICENSE."
00012 //
00013 ////////////////////////////////////////////////////////////////////
00014 
00015 #ifndef EGGNURBSCURVE_H
00016 #define EGGNURBSCURVE_H
00017 
00018 #include "pandabase.h"
00019 
00020 #include "eggCurve.h"
00021 
00022 #include "vector_double.h"
00023 
00024 ////////////////////////////////////////////////////////////////////
00025 //       Class : EggNurbsCurve
00026 // Description : A parametric NURBS curve.
00027 ////////////////////////////////////////////////////////////////////
00028 class EXPCL_PANDAEGG EggNurbsCurve : public EggCurve {
00029 PUBLISHED:
00030   INLINE EggNurbsCurve(const string &name = "");
00031   INLINE EggNurbsCurve(const EggNurbsCurve &copy);
00032   INLINE EggNurbsCurve &operator = (const EggNurbsCurve &copy);
00033 
00034   void setup(int order, int num_knots);
00035 
00036   INLINE void set_order(int order);
00037   void set_num_knots(int num);
00038 
00039   INLINE void set_knot(int k, double value);
00040 
00041   bool is_valid() const;
00042 
00043   INLINE int get_order() const;
00044   INLINE int get_degree() const;
00045   INLINE int get_num_knots() const;
00046   INLINE int get_num_cvs() const;
00047 
00048   bool is_closed() const;
00049 
00050   INLINE double get_knot(int k) const;
00051   MAKE_SEQ(get_knots, get_num_knots, get_knot);
00052 
00053   virtual void write(ostream &out, int indent_level) const;
00054 
00055 private:
00056   typedef vector_double Knots;
00057   Knots _knots;
00058   int _order;
00059 
00060 public:
00061 
00062   static TypeHandle get_class_type() {
00063     return _type_handle;
00064   }
00065   static void init_type() {
00066     EggCurve::init_type();
00067     register_type(_type_handle, "EggNurbsCurve",
00068                   EggCurve::get_class_type());
00069   }
00070   virtual TypeHandle get_type() const {
00071     return get_class_type();
00072   }
00073   virtual TypeHandle force_init_type() {init_type(); return get_class_type();}
00074 
00075 private:
00076   static TypeHandle _type_handle;
00077 
00078 };
00079 
00080 #include "eggNurbsCurve.I"
00081 
00082 #endif
 All Classes Functions Variables Enumerations