00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015 #ifndef NURBSCURVEINTERFACE_H
00016 #define NURBSCURVEINTERFACE_H
00017
00018 #include "pandabase.h"
00019
00020 #include "luse.h"
00021 #include "filename.h"
00022
00023 class ParametricCurve;
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034 class EXPCL_PANDA_PARAMETRICS NurbsCurveInterface {
00035 PUBLISHED:
00036 virtual ~NurbsCurveInterface();
00037 virtual void set_order(int order)=0;
00038 virtual int get_order() const=0;
00039
00040 virtual int get_num_cvs() const=0;
00041 virtual int get_num_knots() const=0;
00042
00043 virtual bool insert_cv(PN_stdfloat t)=0;
00044
00045 INLINE int append_cv(PN_stdfloat x, PN_stdfloat y, PN_stdfloat z);
00046 INLINE int append_cv(const LVecBase3 &v);
00047 INLINE int append_cv(const LVecBase4 &v);
00048
00049 virtual bool remove_cv(int n)=0;
00050 virtual void remove_all_cvs()=0;
00051
00052 INLINE bool set_cv_point(int n, PN_stdfloat x, PN_stdfloat y, PN_stdfloat z);
00053 INLINE bool set_cv_point(int n, const LVecBase3 &v);
00054 INLINE LVecBase3 get_cv_point(int n) const;
00055
00056 bool set_cv_weight(int n, PN_stdfloat w);
00057 INLINE PN_stdfloat get_cv_weight(int n) const;
00058
00059 virtual bool set_cv(int n, const LVecBase4 &v)=0;
00060 virtual LVecBase4 get_cv(int n) const=0;
00061
00062 virtual bool set_knot(int n, PN_stdfloat t)=0;
00063 virtual PN_stdfloat get_knot(int n) const=0;
00064
00065 void write_cv(ostream &out, int n) const;
00066
00067
00068 protected:
00069 virtual int append_cv_impl(const LVecBase4 &v)=0;
00070
00071 void write(ostream &out, int indent_level) const;
00072 bool format_egg(ostream &out, const string &name,
00073 const string &curve_type, int indent_level) const;
00074
00075 bool convert_to_nurbs(ParametricCurve *nc) const;
00076
00077 public:
00078 static TypeHandle get_class_type() {
00079 return _type_handle;
00080 }
00081 static void init_type() {
00082 register_type(_type_handle, "NurbsCurveInterface");
00083 }
00084
00085 private:
00086 static TypeHandle _type_handle;
00087 };
00088
00089 #include "nurbsCurveInterface.I"
00090
00091 #endif