SplineFwd.h
1 // This file is part of Eigen, a lightweight C++ template library
2 // for linear algebra.
3 //
4 // Copyright (C) 20010-2011 Hauke Heibel <hauke.heibel@gmail.com>
5 //
6 // Eigen is free software; you can redistribute it and/or
7 // modify it under the terms of the GNU Lesser General Public
8 // License as published by the Free Software Foundation; either
9 // version 3 of the License, or (at your option) any later version.
10 //
11 // Alternatively, you can redistribute it and/or
12 // modify it under the terms of the GNU General Public License as
13 // published by the Free Software Foundation; either version 2 of
14 // the License, or (at your option) any later version.
15 //
16 // Eigen is distributed in the hope that it will be useful, but WITHOUT ANY
17 // WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
18 // FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License or the
19 // GNU General Public License for more details.
20 //
21 // You should have received a copy of the GNU Lesser General Public
22 // License and a copy of the GNU General Public License along with
23 // Eigen. If not, see <http://www.gnu.org/licenses/>.
24 
25 #ifndef EIGEN_SPLINES_FWD_H
26 #define EIGEN_SPLINES_FWD_H
27 
28 #include <Eigen/Core>
29 
30 namespace Eigen
31 {
32  template <typename Scalar, int Dim, int Degree = Dynamic> class Spline;
33 
34  template < typename SplineType, int DerivativeOrder = Dynamic > struct SplineTraits {};
35 
40  template <typename _Scalar, int _Dim, int _Degree>
41  struct SplineTraits< Spline<_Scalar, _Dim, _Degree>, Dynamic >
42  {
43  typedef _Scalar Scalar;
44  enum { Dimension = _Dim };
45  enum { Degree = _Degree };
46 
47  enum { OrderAtCompileTime = _Degree==Dynamic ? Dynamic : _Degree+1 };
48  enum { NumOfDerivativesAtCompileTime = OrderAtCompileTime };
49 
51  typedef Array<Scalar,1,OrderAtCompileTime> BasisVectorType;
52 
54  typedef Array<Scalar,Dynamic,Dynamic,RowMajor,NumOfDerivativesAtCompileTime,OrderAtCompileTime> BasisDerivativeType;
55 
57  typedef Array<Scalar,Dimension,Dynamic,ColMajor,Dimension,NumOfDerivativesAtCompileTime> DerivativeType;
58 
60  typedef Array<Scalar,Dimension,1> PointType;
61 
63  typedef Array<Scalar,1,Dynamic> KnotVectorType;
64 
66  typedef Array<Scalar,Dimension,Dynamic> ControlPointVectorType;
67  };
68 
75  template < typename _Scalar, int _Dim, int _Degree, int _DerivativeOrder >
76  struct SplineTraits< Spline<_Scalar, _Dim, _Degree>, _DerivativeOrder > : public SplineTraits< Spline<_Scalar, _Dim, _Degree> >
77  {
78  enum { OrderAtCompileTime = _Degree==Dynamic ? Dynamic : _Degree+1 };
79  enum { NumOfDerivativesAtCompileTime = _DerivativeOrder==Dynamic ? Dynamic : _DerivativeOrder+1 };
80 
82  typedef Array<_Scalar,Dynamic,Dynamic,RowMajor,NumOfDerivativesAtCompileTime,OrderAtCompileTime> BasisDerivativeType;
83 
85  typedef Array<_Scalar,_Dim,Dynamic,ColMajor,_Dim,NumOfDerivativesAtCompileTime> DerivativeType;
86  };
87 
89  typedef Spline<float,2> Spline2f;
90 
92  typedef Spline<float,3> Spline3f;
93 
95  typedef Spline<double,2> Spline2d;
96 
98  typedef Spline<double,3> Spline3d;
99 }
100 
101 #endif // EIGEN_SPLINES_FWD_H