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

panda/src/parametrics/nurbsCurveEvaluator.h

Go to the documentation of this file.
00001 // Filename: nurbsCurveEvaluator.h
00002 // Created by:  drose (03Dec02)
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 NURBSCURVEEVALUATOR_H
00020 #define NURBSCURVEEVALUATOR_H
00021 
00022 #include "pandabase.h"
00023 #include "nurbsMatrixVector.h"
00024 #include "nurbsCurveResult.h"
00025 #include "nurbsVertex.h"
00026 #include "pointerTo.h"
00027 #include "vector_float.h"
00028 #include "pvector.h"
00029 #include "nodePath.h"
00030 #include "referenceCount.h"
00031 #include "luse.h"
00032 
00033 ////////////////////////////////////////////////////////////////////
00034 //       Class : NurbsCurveEvaluator
00035 // Description : This class is an abstraction for evaluating NURBS
00036 //               curves.  It accepts an array of vertices, each of
00037 //               which may be in a different coordinate space (as
00038 //               defined by a NodePath), as well as an optional knot
00039 //               vector.
00040 //
00041 //               This is not related to NurbsCurve, ClassicNurbsCurve,
00042 //               CubicCurveseg or any of the ParametricCurve-derived
00043 //               objects in this module.  It is a completely parallel
00044 //               implementation of NURBS curves, and will probably
00045 //               eventually replace the whole ParametricCurve class
00046 //               hierarchy.
00047 ////////////////////////////////////////////////////////////////////
00048 class EXPCL_PANDA NurbsCurveEvaluator : public ReferenceCount {
00049 PUBLISHED:
00050   NurbsCurveEvaluator();
00051   ~NurbsCurveEvaluator();
00052 
00053   INLINE void set_order(int order);
00054   INLINE int get_order() const;
00055 
00056   void reset(int num_vertices);
00057 
00058   INLINE int get_num_vertices() const;
00059   INLINE void set_vertex(int i, const LVecBase4f &vertex);
00060   INLINE void set_vertex(int i, const LVecBase3f &vertex, float weight = 1.0);
00061   INLINE const LVecBase4f &get_vertex(int i) const;
00062 
00063   INLINE void set_vertex_space(int i, const NodePath &space);
00064   INLINE void set_vertex_space(int i, const string &space);
00065   NodePath get_vertex_space(int i, const NodePath &rel_to) const;
00066 
00067   INLINE int get_num_knots() const;
00068   void set_knot(int i, float knot);
00069   float get_knot(int i) const;
00070 
00071   PT(NurbsCurveResult) evaluate(const NodePath &rel_to = NodePath()) const;
00072 
00073 public:
00074   void get_vertices(pvector<LVecBase4f> &verts, const NodePath &rel_to) const;
00075   void get_vertices(pvector<LPoint3f> &verts, const NodePath &rel_to) const;
00076 
00077 private:
00078   void recompute_knots();
00079   void recompute_basis();
00080 
00081   int _order;
00082 
00083   typedef pvector<NurbsVertex> Vertices;
00084   Vertices _vertices;
00085 
00086   bool _knots_dirty;
00087   typedef vector_float Knots;
00088   Knots _knots;
00089 
00090   bool _basis_dirty;
00091   NurbsMatrixVector _basis;
00092 };
00093 
00094 #include "nurbsCurveEvaluator.I"
00095 
00096 #endif
00097 

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