Panda3D
|
00001 // Filename: nurbsBasisVector.h 00002 // Created by: drose (03Dec02) 00003 // 00004 //////////////////////////////////////////////////////////////////// 00005 // 00006 // PANDA 3D SOFTWARE 00007 // Copyright (c) Carnegie Mellon University. All rights reserved. 00008 // 00009 // All use of this software is subject to the terms of the revised BSD 00010 // license. You should have received a copy of this license along 00011 // with this source code in a file named "LICENSE." 00012 // 00013 //////////////////////////////////////////////////////////////////// 00014 00015 #ifndef NURBSBASISVECTOR_H 00016 #define NURBSBASISVECTOR_H 00017 00018 #include "pandabase.h" 00019 #include "luse.h" 00020 #include "pvector.h" 00021 #include "pmap.h" 00022 00023 class NurbsVertex; 00024 00025 //////////////////////////////////////////////////////////////////// 00026 // Class : NurbsBasisVector 00027 // Description : This encapsulates a series of matrices that are used 00028 // to represent the sequential segments of a 00029 // NurbsCurveEvaluator. 00030 // 00031 // This is not related to NurbsCurve, CubicCurveseg or 00032 // any of the ParametricCurve-derived objects in this 00033 // module. It is a completely parallel implementation 00034 // of NURBS curves, and will probably eventually replace 00035 // the whole ParametricCurve class hierarchy. 00036 //////////////////////////////////////////////////////////////////// 00037 class EXPCL_PANDA_PARAMETRICS NurbsBasisVector { 00038 public: 00039 INLINE NurbsBasisVector(); 00040 INLINE ~NurbsBasisVector(); 00041 00042 INLINE int get_order() const; 00043 00044 INLINE int get_num_segments() const; 00045 INLINE PN_stdfloat get_start_t() const; 00046 INLINE PN_stdfloat get_end_t() const; 00047 00048 INLINE int get_vertex_index(int segment) const; 00049 INLINE PN_stdfloat get_from(int segment) const; 00050 INLINE PN_stdfloat get_to(int segment) const; 00051 INLINE const LMatrix4 &get_basis(int segment) const; 00052 INLINE PN_stdfloat scale_t(int segment, PN_stdfloat t) const; 00053 00054 void clear(int order); 00055 void append_segment(int vertex_index, const PN_stdfloat knots[]); 00056 00057 void transpose(); 00058 00059 private: 00060 static LVecBase4 nurbs_blending_function(int order, int i, int j, 00061 const PN_stdfloat knots[]); 00062 00063 private: 00064 int _order; 00065 00066 class Segment { 00067 public: 00068 int _vertex_index; 00069 PN_stdfloat _from; 00070 PN_stdfloat _to; 00071 LMatrix4 _basis; 00072 }; 00073 00074 typedef epvector<Segment> Segments; 00075 Segments _segments; 00076 }; 00077 00078 #include "nurbsBasisVector.I" 00079 00080 #endif 00081