00001 #ifndef MATH_PATH_H 00002 #define MATH_PATH_H 00003 00004 /* 00005 00006 GLT OpenGL C++ Toolkit (LGPL) 00007 Copyright (C) 2000-2002 Nigel Stewart 00008 00009 Email: nigels.com@gmail.com 00010 WWW: http://www.nigels.com/glt/ 00011 00012 This library is free software; you can redistribute it and/or 00013 modify it under the terms of the GNU Lesser General Public 00014 License as published by the Free Software Foundation; either 00015 version 2.1 of the License, or (at your option) any later version. 00016 00017 This library is distributed in the hope that it will be useful, 00018 but WITHOUT ANY WARRANTY; without even the implied warranty of 00019 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00020 Lesser General Public License for more details. 00021 00022 You should have received a copy of the GNU Lesser General Public 00023 License along with this library; if not, write to the Free Software 00024 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 00025 00026 */ 00027 00033 #include <math/vector3.h> 00034 #include <math/matrix4.h> 00035 00041 class GltPath3D 00042 { 00043 public: 00044 00046 GltPath3D(); 00048 virtual ~GltPath3D(); 00049 00051 virtual Vector f(const real t) const = 0; 00053 virtual Vector df(const real t) const = 0; 00055 virtual Vector ddf(const real t) const = 0; 00056 }; 00057 00063 class GltPath3DLine : public GltPath3D 00064 { 00065 public: 00067 GltPath3DLine(const Vector &origin,const Vector &direction); 00068 00069 Vector f(const real t) const; 00070 Vector df(const real t) const; 00071 Vector ddf(const real t) const; 00072 00073 private: 00074 const Vector _origin; 00075 const Vector _direction; 00076 }; 00077 00084 class GltPath3DHelix : public GltPath3D 00085 { 00086 public: 00088 GltPath3DHelix(const Vector &origin,const Vector &direction,const real radius,const real freq,const real phase); 00089 00090 Vector f(const real t) const; 00091 Vector df(const real t) const; 00092 Vector ddf(const real t) const; 00093 00094 private: 00095 Matrix _trans; 00096 const Vector _origin; 00097 const Vector _direction; 00098 const real _radius; 00099 const real _freq; 00100 const real _phase; 00101 }; 00102 00103 00112 class GltPath3DSegment : public GltPath3D 00113 { 00114 public: 00116 GltPath3DSegment(const GltPath3D &f,const real begin,const real end); 00117 00118 Vector f(const real t) const; 00119 Vector df(const real t) const; 00120 Vector ddf(const real t) const; 00121 00122 private: 00123 00124 real segT(const real t) const; 00125 00126 const GltPath3D &_func; 00127 const real _begin; 00128 const real _end; 00129 }; 00130 00131 #endif 00132