// ------------------------------------------------------------------------- // @author Leonardo Florez-Valencia (florez-l@javeriana.edu.co) // ------------------------------------------------------------------------- #ifndef __CPEXTENSIONS__ALGORITHMS__BEZIERCURVEFUNCTION__H__ #define __CPEXTENSIONS__ALGORITHMS__BEZIERCURVEFUNCTION__H__ #include #include #include namespace cpExtensions { namespace Algorithms { /** * Uses the De Casteljau's algorithm. */ template< class V > class BezierCurveFunction : public itk::FunctionBase< typename V::ValueType, V > { public: typedef BezierCurveFunction Self; typedef itk::FunctionBase< typename V::ValueType, V > Superclass; typedef itk::SmartPointer< Self > Pointer; typedef itk::SmartPointer< const Self > ConstPointer; typedef V TVector; typedef typename V::ValueType TScalar; typedef itk::Matrix< TScalar, TVector::Dimension, TVector::Dimension > TFrame; typedef std::vector< TVector > TVectorsContainer; public: itkNewMacro( Self ); itkTypeMacro( BezierCurveFunction, itkFunctionBase ); public: virtual void AddPoint( const TVector& v ); virtual unsigned int GetNumberOfPoints( ) const; virtual TVector Evaluate( const TScalar& u ) const ITK_OVERRIDE; virtual TFrame EvaluateFrenetFrame( const TScalar& u ) const; virtual TScalar EvaluateLength( ) const; protected: BezierCurveFunction( ); virtual ~BezierCurveFunction( ) { } void _UpdateDerivative( ) const; private: // Purposely not implemented BezierCurveFunction( const Self& other ); Self& operator=( const Self& other ); protected: TVectorsContainer m_Vectors; mutable Pointer m_Derivative; mutable bool m_DerivativeUpdated; }; } // ecapseman } // ecapseman #ifndef ITK_MANUAL_INSTANTIATION #include #endif // ITK_MANUAL_INSTANTIATION #endif // __CPEXTENSIONS__ALGORITHMS__BEZIERCURVEFUNCTION__H__ // eof - $RCSfile$