1 // -------------------------------------------------------------------------
2 // @author Leonardo Florez-Valencia (florez-l@javeriana.edu.co)
3 // -------------------------------------------------------------------------
5 #ifndef __CPEXTENSIONS__ALGORITHMS__BEZIERCURVEFUNCTION__H__
6 #define __CPEXTENSIONS__ALGORITHMS__BEZIERCURVEFUNCTION__H__
8 #include <cpExtensions/Config.h>
10 #include <itkFunctionBase.h>
11 #include <itkMatrix.h>
13 namespace cpExtensions
18 * Uses the De Casteljau's algorithm.
21 class BezierCurveFunction
22 : public itk::FunctionBase< typename V::ValueType, V >
25 typedef BezierCurveFunction Self;
26 typedef itk::FunctionBase< typename V::ValueType, V > Superclass;
27 typedef itk::SmartPointer< Self > Pointer;
28 typedef itk::SmartPointer< const Self > ConstPointer;
31 typedef typename V::ValueType TScalar;
34 itk::Matrix< TScalar, TVector::Dimension, TVector::Dimension >
36 typedef std::vector< TVector > TVectorsContainer;
40 itkTypeMacro( BezierCurveFunction, itkFunctionBase );
43 virtual void AddPoint( const TVector& v );
44 virtual unsigned int GetNumberOfPoints( ) const;
46 virtual TVector Evaluate( const TScalar& u ) const cpExtensions_OVERRIDE;
47 virtual TFrame EvaluateFrenetFrame( const TScalar& u ) const;
48 virtual TScalar EvaluateLength( ) const;
51 BezierCurveFunction( );
52 virtual ~BezierCurveFunction( ) { }
54 void _UpdateDerivative( ) const;
57 // Purposely not implemented
58 BezierCurveFunction( const Self& other );
59 Self& operator=( const Self& other );
62 TVectorsContainer m_Vectors;
63 mutable Pointer m_Derivative;
64 mutable bool m_DerivativeUpdated;
71 #ifndef ITK_MANUAL_INSTANTIATION
72 # include <cpExtensions/Algorithms/BezierCurveFunction.hxx>
73 #endif // ITK_MANUAL_INSTANTIATION
75 #endif // __CPEXTENSIONS__ALGORITHMS__BEZIERCURVEFUNCTION__H__