00001 /**************************************************************************** 00002 Copyright (C)2003 David Jung <opensim@pobox.com> 00003 00004 This program/file is free software; you can redistribute it and/or modify 00005 it under the terms of the GNU General Public License as published by 00006 the Free Software Foundation; either version 2 of the License, or 00007 (at your option) any later version. 00008 00009 This program is distributed in the hope that it will be useful, 00010 but WITHOUT ANY WARRANTY; without even the implied warranty of 00011 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00012 GNU General Public License for more details. (http://www.gnu.org) 00013 00014 You should have received a copy of the GNU General Public License 00015 along with this program; if not, write to the Free Software 00016 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 00017 00018 $Id: ParametricPathRep 1029 2004-02-11 20:45:54Z jungd $ 00019 $Revision: 1.1 $ 00020 $Date: 2004-02-11 15:45:54 -0500 (Wed, 11 Feb 2004) $ 00021 $Author: jungd $ 00022 00023 ****************************************************************************/ 00024 00025 #ifndef _BASE_PARAMETRICPATHREP_ 00026 #define _BASE_PARAMETRICPATHREP_ 00027 00028 #include <base/PathRep> 00029 #include <base/Expression> 00030 #include <base/Math> 00031 00032 00033 namespace base { 00034 00035 00036 /// Concrete path representation as a set of symbolic parametric equations (functions of s) 00037 class ParametricPathRep : public PathRep 00038 { 00039 public: 00040 ParametricPathRep(const ExpressionVector& p); 00041 00042 virtual Object& clone() const 00043 { return *NewObj ParametricPathRep(v); } 00044 00045 virtual String className() const { return String("ParametricPathRep"); } 00046 00047 /// get cartesian position at s:[0..1] 00048 virtual Point3 position(Real s) const; 00049 00050 /// get orientation at s:[0..1] 00051 virtual Orient orientation(Real s) const; 00052 00053 virtual Real distinguishedValue(Int i) const; 00054 00055 /// number of distinguished s values 00056 virtual Int numDistinguishedValues() const; 00057 00058 /// translate the path position by t 00059 virtual void translate(const Vector3& t); 00060 00061 /// rotate the path orientation by r 00062 virtual void rotate(const Quat4& r); 00063 00064 /// transform the path by m 00065 virtual void transform(const Matrix4& m); 00066 00067 virtual void scalePosition(Real s); 00068 00069 virtual void serialize(Serializer& s); 00070 00071 protected: 00072 enum Flags { None=0, HasOrient=1 }; 00073 00074 ParametricPathRep() {} 00075 00076 ExpressionVector v; ///< parametric rep of path (symbolic expressions for x,y,z[,r,p,y | ,q0,q1,q2,w]) in terms of s in [0..1] 00077 00078 Int flags; 00079 00080 friend class Trajectory; 00081 friend class Serializable::SerializableDerivedInstantiator<ParametricPathRep>; 00082 }; 00083 00084 00085 } // base 00086 00087 #endif