Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members  

panda/src/parametrics/nurbsCurveInterface.h

Go to the documentation of this file.
00001 // Filename: nurbsCurveInterface.h
00002 // Created by:  drose (02Mar01)
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 NURBSCURVEINTERFACE_H
00020 #define NURBSCURVEINTERFACE_H
00021 
00022 #include <pandabase.h>
00023 
00024 #include <luse.h>
00025 #include <filename.h>
00026 
00027 class ParametricCurve;
00028 
00029 ////////////////////////////////////////////////////////////////////
00030 //       Class : NurbsCurveInterface
00031 // Description : This abstract class defines the interface only for a
00032 //               Nurbs-style curve, with knots and coordinates in
00033 //               homogeneous space.
00034 //
00035 //               The NurbsCurve class inherits both from this and from
00036 //               ParametricCurve.
00037 ////////////////////////////////////////////////////////////////////
00038 class EXPCL_PANDA NurbsCurveInterface {
00039 PUBLISHED:
00040   virtual void set_order(int order)=0;
00041   virtual int get_order() const=0;
00042 
00043   virtual int get_num_cvs() const=0;
00044   virtual int get_num_knots() const=0;
00045 
00046   virtual bool insert_cv(float t)=0;
00047 
00048   INLINE int append_cv(float x, float y, float z);
00049   INLINE int append_cv(const LVecBase3f &v);
00050   INLINE int append_cv(const LVecBase4f &v);
00051 
00052   virtual bool remove_cv(int n)=0;
00053   virtual void remove_all_cvs()=0;
00054 
00055   INLINE bool set_cv_point(int n, float x, float y, float z);
00056   INLINE bool set_cv_point(int n, const LVecBase3f &v);
00057   INLINE LVecBase3f get_cv_point(int n) const;
00058 
00059   bool set_cv_weight(int n, float w);
00060   INLINE float get_cv_weight(int n) const;
00061 
00062   virtual bool set_cv(int n, const LVecBase4f &v)=0;
00063   virtual LVecBase4f get_cv(int n) const=0;
00064 
00065   virtual bool set_knot(int n, float t)=0;
00066   virtual float get_knot(int n) const=0;
00067 
00068   void write_cv(ostream &out, int n) const;
00069 
00070 
00071 protected:
00072   virtual int append_cv_impl(const LVecBase4f &v)=0;
00073 
00074   void write(ostream &out, int indent_level) const;
00075   bool format_egg(ostream &out, const string &name,
00076                   const string &curve_type, int indent_level) const;
00077 
00078   bool convert_to_nurbs(ParametricCurve *nc) const;
00079 
00080 public:
00081   static TypeHandle get_class_type() {
00082     return _type_handle;
00083   }
00084   static void init_type() {
00085     register_type(_type_handle, "NurbsCurveInterface");
00086   }
00087 
00088 private:
00089   static TypeHandle _type_handle;
00090 };
00091 
00092 #include "nurbsCurveInterface.I"
00093 
00094 #endif

Generated on Fri May 2 00:40:46 2003 for Panda by doxygen1.3