/*========================================================================= Program: wxMaracas Module: $RCSfile: curve.hxx,v $ Language: C++ Date: $Date: 2009/05/14 13:55:07 $ Version: $Revision: 1.1 $ Copyright: (c) 2002, 2003 License: This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the above copyright notice for more information. =========================================================================*/ #ifndef KGFO__CURVE__HXX #define KGFO__CURVE__HXX #include #include "marTypes.h" /*! \brief Parametrized n-dimensional curve. * * This class realizes a parametric curve model, given some control points. */ class MAR_KERNEL_EXPORT kCurve { public: kCurve( size_t dim = 3, size_t sdim = 0 ); ~kCurve( ); kCurve& operator=( const kCurve& r ); uint getDimension( ) const { return( _dimension ); } uint getStateDimension( ) const { return( _stateDim ); } uint getClosestControlPoint( double* p ); void getPoint( double* p, double s ); void getState( double* st, double s ); void getTangent( double* tg, double s ); void getNormal( double* n, double s ); void getBinormal( double* b, double s ); void addControlPoint( double* cp, double* sp ); void getControlPoint( int i, double* cp, double* sp ); void setControlPoint( int i, double* cp, double* sp ); uint getNumberOfControlPoints( ) { return( _controlPoints.size( ) ); } double length( double step = 0.01 ); double projectOverControlPoints( double* pr, double* pt ); double projectOverCurve( double* pr, double* pt ); void evaluate( double* p, int i, double t ); void evalState( double* s, int i, double t ); void derivative1( double* d, int i, double t ); void derivative2( double* d, int i, double t ); void reset( ); public: static int MAX_DIMENSION; static int MAX_STATE_DIMENSION; protected: std::vector< double* > _controlPoints; std::vector< double* > _controlState; uint _dimension; uint _stateDim; private: void loadCatmullControlMatrix( int i ); void loadCatmullStateMatrix( int i ); void calculeSplineArguments( double s, int& i, double& t ); std::vector< double > _controlT; std::vector< double > _controlL; double* _mC; double* _mS; }; #endif // KGFO__CURVE__HXX // eof - curve.hxx