SplineFwd.h
00001 // This file is part of Eigen, a lightweight C++ template library
00002 // for linear algebra.
00003 //
00004 // Copyright (C) 20010-2011 Hauke Heibel <hauke.heibel@gmail.com>
00005 //
00006 // Eigen is free software; you can redistribute it and/or
00007 // modify it under the terms of the GNU Lesser General Public
00008 // License as published by the Free Software Foundation; either
00009 // version 3 of the License, or (at your option) any later version.
00010 //
00011 // Alternatively, you can redistribute it and/or
00012 // modify it under the terms of the GNU General Public License as
00013 // published by the Free Software Foundation; either version 2 of
00014 // the License, or (at your option) any later version.
00015 //
00016 // Eigen is distributed in the hope that it will be useful, but WITHOUT ANY
00017 // WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
00018 // FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License or the
00019 // GNU General Public License for more details.
00020 //
00021 // You should have received a copy of the GNU Lesser General Public
00022 // License and a copy of the GNU General Public License along with
00023 // Eigen. If not, see <http://www.gnu.org/licenses/>.
00024 
00025 #ifndef EIGEN_SPLINES_FWD_H
00026 #define EIGEN_SPLINES_FWD_H
00027 
00028 #include <Eigen/Core>
00029 
00030 namespace Eigen
00031 {
00032     template <typename Scalar, int Dim, int Degree = Dynamic> class Spline;
00033 
00034     template < typename SplineType, int DerivativeOrder = Dynamic > struct SplineTraits {};
00035 
00040     template <typename _Scalar, int _Dim, int _Degree>
00041     struct SplineTraits< Spline<_Scalar, _Dim, _Degree>, Dynamic >
00042     {
00043       typedef _Scalar Scalar; 
00044       enum { Dimension = _Dim  };
00045       enum { Degree = _Degree  };
00046 
00047       enum { OrderAtCompileTime = _Degree==Dynamic ? Dynamic : _Degree+1  };
00048       enum { NumOfDerivativesAtCompileTime = OrderAtCompileTime  };
00049 
00051       typedef Array<Scalar,1,OrderAtCompileTime> BasisVectorType;
00052 
00054       typedef Array<Scalar,Dynamic,Dynamic,RowMajor,NumOfDerivativesAtCompileTime,OrderAtCompileTime> BasisDerivativeType;
00055       
00057       typedef Array<Scalar,Dimension,Dynamic,ColMajor,Dimension,NumOfDerivativesAtCompileTime> DerivativeType;
00058 
00060       typedef Array<Scalar,Dimension,1> PointType;
00061       
00063       typedef Array<Scalar,1,Dynamic> KnotVectorType;
00064       
00066       typedef Array<Scalar,Dimension,Dynamic> ControlPointVectorType;
00067     };
00068 
00075     template < typename _Scalar, int _Dim, int _Degree, int _DerivativeOrder >
00076     struct SplineTraits< Spline<_Scalar, _Dim, _Degree>, _DerivativeOrder > : public SplineTraits< Spline<_Scalar, _Dim, _Degree> >
00077     {
00078       enum { OrderAtCompileTime = _Degree==Dynamic ? Dynamic : _Degree+1  };
00079       enum { NumOfDerivativesAtCompileTime = _DerivativeOrder==Dynamic ? Dynamic : _DerivativeOrder+1  };
00080 
00082       typedef Array<_Scalar,Dynamic,Dynamic,RowMajor,NumOfDerivativesAtCompileTime,OrderAtCompileTime> BasisDerivativeType;
00083       
00085       typedef Array<_Scalar,_Dim,Dynamic,ColMajor,_Dim,NumOfDerivativesAtCompileTime> DerivativeType;
00086     };
00087 
00089     typedef Spline<float,2> Spline2f;
00090     
00092     typedef Spline<float,3> Spline3f;
00093 
00095     typedef Spline<double,2> Spline2d;
00096     
00098     typedef Spline<double,3> Spline3d;
00099 }
00100 
00101 #endif // EIGEN_SPLINES_FWD_H