1 // -------------------------------------------------------------------------
2 // @author Leonardo Florez-Valencia (florez-l@javeriana.edu.co)
3 // -------------------------------------------------------------------------
5 #ifndef __CPEXTENSIONS__ALGORITHMS__BEZIERCURVEFUNCTION__H__
6 #define __CPEXTENSIONS__ALGORITHMS__BEZIERCURVEFUNCTION__H__
9 #include <itkFunctionBase.h>
10 #include <itkMatrix.h>
12 namespace cpExtensions
17 * Uses the De Casteljau's algorithm.
20 class BezierCurveFunction
21 : public itk::FunctionBase< typename V::ValueType, V >
24 typedef BezierCurveFunction Self;
25 typedef itk::FunctionBase< typename V::ValueType, V > Superclass;
26 typedef itk::SmartPointer< Self > Pointer;
27 typedef itk::SmartPointer< const Self > ConstPointer;
30 typedef typename V::ValueType TScalar;
33 itk::Matrix< TScalar, TVector::Dimension, TVector::Dimension >
35 typedef std::vector< TVector > TVectorsContainer;
39 itkTypeMacro( BezierCurveFunction, itkFunctionBase );
42 virtual void AddPoint( const TVector& v );
43 virtual unsigned int GetNumberOfPoints( ) const;
45 virtual TVector Evaluate( const TScalar& u ) const;
46 virtual TFrame EvaluateFrenetFrame( const TScalar& u ) const;
47 virtual TScalar EvaluateLength( ) const;
50 BezierCurveFunction( );
51 virtual ~BezierCurveFunction( ) { }
53 void _UpdateDerivative( ) const;
56 // Purposely not implemented
57 BezierCurveFunction( const Self& other );
58 Self& operator=( const Self& other );
61 TVectorsContainer m_Vectors;
62 mutable Pointer m_Derivative;
63 mutable bool m_DerivativeUpdated;
70 #ifndef ITK_MANUAL_INSTANTIATION
71 #include <cpExtensions/Algorithms/BezierCurveFunction.hxx>
72 #endif // ITK_MANUAL_INSTANTIATION
74 #endif // __CPEXTENSIONS__ALGORITHMS__BEZIERCURVEFUNCTION__H__