1 /*=========================================================================
4 Module: $RCSfile: curve.hxx,v $
6 Date: $Date: 2010/04/20 16:11:41 $
7 Version: $Revision: 1.2 $
9 Copyright: (c) 2002, 2003
12 This software is distributed WITHOUT ANY WARRANTY; without even
13 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
14 PURPOSE. See the above copyright notice for more information.
16 =========================================================================*/
18 #ifndef KGFO__CURVE__HXX
19 #define KGFO__CURVE__HXX
24 /*! \brief Parametrized n-dimensional curve.
26 * This class realizes a parametric curve model, given some control points.
28 class MAR_KERNEL_EXPORT kCurve
32 kCurve( size_t dim = 3, size_t sdim = 0 );
35 kCurve& operator=( const kCurve& r );
37 uint32_t getDimension( ) const
42 uint32_t getStateDimension( ) const
47 uint32_t getClosestControlPoint( double* p );
49 void getPoint( double* p, double s );
50 void getState( double* st, double s );
51 void getTangent( double* tg, double s );
52 void getNormal( double* n, double s );
53 void getBinormal( double* b, double s );
55 void addControlPoint( double* cp, double* sp );
56 void getControlPoint( int i, double* cp, double* sp );
57 void setControlPoint( int i, double* cp, double* sp );
58 uint32_t getNumberOfControlPoints( )
60 return( _controlPoints.size( ) );
63 double length( double step = 0.01 );
65 double projectOverControlPoints( double* pr, double* pt );
66 double projectOverCurve( double* pr, double* pt );
68 void evaluate( double* p, int i, double t );
69 void evalState( double* s, int i, double t );
71 void derivative1( double* d, int i, double t );
72 void derivative2( double* d, int i, double t );
78 static int MAX_DIMENSION;
79 static int MAX_STATE_DIMENSION;
83 std::vector< double* > _controlPoints;
84 std::vector< double* > _controlState;
90 void loadCatmullControlMatrix( int i );
91 void loadCatmullStateMatrix( int i );
92 void calculeSplineArguments( double s, int& i, double& t );
94 std::vector< double > _controlT;
95 std::vector< double > _controlL;
102 #endif // KGFO__CURVE__HXX