00001 // rdSpline.cpp 00002 //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 00003 // Copyright 2000 Realistic Dynamics, Inc. 00004 // All rights reserved. 00005 // 00006 // Please do not read, copy, distribute, or use without permission. 00007 // Contact: Frank C. Anderson, fca@RealisticDynamics.com 00008 //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 00009 00010 #ifndef __rdSpline_h__ 00011 #define __rdSpline_h__ 00012 00013 00014 // INCLUDES 00015 #include "rdTools.h" 00016 00017 // DEFINES 00018 #define RDSPLINE_MAXSIZE 2048 00019 00020 00021 //============================================================================= 00022 //============================================================================= 00026 class RDTOOLS_API rdSpline 00027 { 00028 //============================================================================= 00029 // DATA 00030 //============================================================================= 00031 private: 00032 int _status; 00033 char _name[RDSPLINE_MAXSIZE]; 00034 double _ti,_tf; 00035 int _order; 00036 int _nknots; 00037 int _ncoefs; 00038 double *_knots; 00039 double *_coefs; 00040 double *_tx; 00041 double *_b; 00042 00043 //============================================================================= 00044 // METHODS 00045 //============================================================================= 00046 public: 00047 //-------------------------------------------------------------------------- 00048 // CONSTRUCTION 00049 //-------------------------------------------------------------------------- 00050 //rdSpline(const char *aName,double aTI,double aTF,int aOrder, 00051 // int aNKnots,double *aKnots,int aNCoefs,double *aCoefs); 00052 virtual ~rdSpline(); 00053 rdSpline(const char* aFileName); 00054 rdSpline(FILE *aFP); 00055 private: 00056 int initialize(FILE *aFP); 00057 void null(); 00058 int checkFileStatus(int aStatus); 00059 00060 //-------------------------------------------------------------------------- 00061 // EVALUATION 00062 //-------------------------------------------------------------------------- 00063 public: 00064 int getKnotIndex(double x); 00065 double evaluate(double x); 00066 00067 //-------------------------------------------------------------------------- 00068 // PRINTING 00069 //-------------------------------------------------------------------------- 00070 void print(); 00071 00072 //============================================================================= 00073 }; // END class rdSpline 00074 //============================================================================= 00075 //============================================================================= 00076 00077 #endif // __rdSpline_h__
1.3