/* * PVVMUD a 3D MUD * Copyright (C) 1998-1999 Programvareverkstedet (pvv@pvv.org) * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ #ifndef _SPLINE_H #define _SPLINE_H #include "keyframe.H" class CSpline: public CInterpolate { CMatrix * m_basis; public: CSpline(CMatrix * basis); virtual CVector interpolate(double time, ControlVector_t * controlVector); virtual CVector interpolate(double time, CMatrix & control); }; //////////////////////////////////////////////////////////////////////////////// // Catmull-Rom // For N segments we need 4+(N-1) control vectors [0..K] // Line pass through all control vector except first and last. // s control the tension of the curve. //////////////////////////////////////////////////////////////////////////////// class CCatmullRom : public CSpline{ public: CCatmullRom(double s = 1.0); virtual void addControlVector(CKeyFrame * keyFrame, const ControlVector_t & controlVector); }; //////////////////////////////////////////////////////////////////////////////// // Bezier // For N segments we need 4+3*(N-1) control vectors [0..K] // Line pass through every 4. control vector including first and last. // Every 2. and 3. points are used to control the curve form. //////////////////////////////////////////////////////////////////////////////// class CBezier : public CSpline { static CMatrix m_bezier; public: CBezier(); virtual void addControlVector(CKeyFrame * keyFrame, const ControlVector_t & controlVector); }; //////////////////////////////////////////////////////////////////////////////// // Hermite // For N segments we need 4+2*(N-1) control vectors [0..K] // Line pass through every odd control vector. Every even contorl vector // is a tangent for the curve. //////////////////////////////////////////////////////////////////////////////// class CHermite : public CSpline { static CMatrix m_hermite; public: CHermite(); virtual void addControlVector(CKeyFrame * keyFrame, const ControlVector_t & controlVector); }; #endif // _SPLINE_H