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