00001 /* "THE BEER-WARE LICENSE" (Revision 42): Devin Lane wrote this file. As long as you retain 00002 * this notice you can do whatever you want with this stuff. If we meet some day, and you 00003 * think this stuff is worth it, you can buy me a beer in return. */ 00004 00005 #include "SplineCoeff.h" 00006 00007 SplineCoeff::SplineCoeff(double t, 00008 const SplinePair &a, 00009 const SplinePair &b, 00010 const SplinePair &c, 00011 const SplinePair &d) : 00012 m_t(t), 00013 m_a(a), 00014 m_b(b), 00015 m_c(c), 00016 m_d(d) 00017 { 00018 } 00019 00020 bool SplineCoeff::operator<(const SplineCoeff &c) const 00021 { 00022 return m_t < c.t(); 00023 } 00024 00025 bool SplineCoeff::operator<(double t) const 00026 { 00027 return m_t < t; 00028 } 00029 00030 SplinePair SplineCoeff::a () const 00031 { 00032 return m_a; 00033 } 00034 00035 SplinePair SplineCoeff::b () const 00036 { 00037 return m_b; 00038 } 00039 00040 SplinePair SplineCoeff::c () const 00041 { 00042 return m_c; 00043 } 00044 00045 SplinePair SplineCoeff::d () const 00046 { 00047 return m_d; 00048 } 00049 00050 SplinePair SplineCoeff::eval(double t) const 00051 { 00052 double deltat = t - m_t; 00053 return m_a + m_b * deltat + m_c * (deltat * deltat) + m_d * (deltat * deltat * deltat); 00054 } 00055 00056 double SplineCoeff::t () const 00057 { 00058 return m_t; 00059 }