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

panda/src/parametrics/nurbsMatrixVector.h

Go to the documentation of this file.
00001 // Filename: nurbsMatrixVector.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 NURBSMATRIXVECTOR_H
00020 #define NURBSMATRIXVECTOR_H
00021 
00022 #include "pandabase.h"
00023 #include "luse.h"
00024 #include "pvector.h"
00025 #include "pmap.h"
00026 
00027 ////////////////////////////////////////////////////////////////////
00028 //       Class : NurbsMatrixVector
00029 // Description : This encapsulates a series of matrices that are used
00030 //               to represent the sequential segments of a
00031 //               NurbsCurveEvaluator.
00032 //
00033 //               This is not related to NurbsCurve, ClassicNurbsCurve,
00034 //               CubicCurveseg or any of the ParametricCurve-derived
00035 //               objects in this module.  It is a completely parallel
00036 //               implementation of NURBS curves, and will probably
00037 //               eventually replace the whole ParametricCurve class
00038 //               hierarchy.
00039 ////////////////////////////////////////////////////////////////////
00040 class EXPCL_PANDA NurbsMatrixVector {
00041 public:
00042   INLINE NurbsMatrixVector();
00043   INLINE ~NurbsMatrixVector();
00044 
00045   INLINE int get_num_segments() const;
00046   INLINE float get_start_t() const;
00047   INLINE float get_end_t() const;
00048 
00049   INLINE int get_vertex_index(int segment) const;
00050   INLINE float get_from(int segment) const;
00051   INLINE float get_to(int segment) const;
00052   INLINE const LMatrix4f &get_matrix(int segment) const;
00053   INLINE float scale_t(int segment, float t) const;
00054 
00055   void clear();
00056   void append_segment(int order, int vertex_index, const float knots[]);
00057   void compose_segment(const NurbsMatrixVector &basis, int segment, 
00058                        const LMatrix4f &geom);
00059 
00060 private:
00061   static LVecBase4f nurbs_blending_function(int order, int i, int j, 
00062                                             const float knots[]);
00063 
00064 private:
00065   class Segment {
00066   public:
00067     int _vertex_index;
00068     float _from;
00069     float _to;
00070     LMatrix4f _matrix;
00071   };
00072 
00073   typedef pvector<Segment> Segments;
00074   Segments _segments;
00075 };
00076 
00077 #include "nurbsMatrixVector.I"
00078 
00079 #endif
00080 

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