// ------------------------------------------------------------------------- // @author Leonardo Florez-Valencia (florez-l@javeriana.edu.co) // ------------------------------------------------------------------------- #include // ------------------------------------------------------------------------- template< class _TPolyLine, class _TCurve > _TPolyLine* cpExtensions::Algorithms::PolyLineParametricPathToSimple3DCurve< _TPolyLine, _TCurve >:: GetInput( ) { return( dynamic_cast< _TPolyLine* >( this->Superclass::GetInput( 0 ) ) ); } // ------------------------------------------------------------------------- template< class _TPolyLine, class _TCurve > const _TPolyLine* cpExtensions::Algorithms::PolyLineParametricPathToSimple3DCurve< _TPolyLine, _TCurve >:: GetInput( ) const { return( dynamic_cast< const _TPolyLine* >( this->Superclass::GetInput( 0 ) ) ); } // ------------------------------------------------------------------------- template< class _TPolyLine, class _TCurve > void cpExtensions::Algorithms::PolyLineParametricPathToSimple3DCurve< _TPolyLine, _TCurve >:: SetInput( _TPolyLine* pl ) { this->Superclass::SetNthInput( 0, pl ); } // ------------------------------------------------------------------------- template< class _TPolyLine, class _TCurve > _TCurve* cpExtensions::Algorithms::PolyLineParametricPathToSimple3DCurve< _TPolyLine, _TCurve >:: GetOutput( ) { return( dynamic_cast< _TCurve* >( this->Superclass::GetOutput( 0 ) ) ); } // ------------------------------------------------------------------------- template< class _TPolyLine, class _TCurve > const _TCurve* cpExtensions::Algorithms::PolyLineParametricPathToSimple3DCurve< _TPolyLine, _TCurve >:: GetOutput( ) const { return( dynamic_cast< const _TCurve* >( this->Superclass::GetOutput( 0 ) ) ); } // ------------------------------------------------------------------------- template< class _TPolyLine, class _TCurve > cpExtensions::Algorithms::PolyLineParametricPathToSimple3DCurve< _TPolyLine, _TCurve >:: PolyLineParametricPathToSimple3DCurve( ) : Superclass( ), m_NumberOfSamples( 0 ) { this->SetNumberOfRequiredInputs( 1 ); this->SetNumberOfRequiredOutputs( 1 ); typename _TCurve::Pointer curve = _TCurve::New( ); this->Superclass::SetNthOutput( 0, curve ); } // ------------------------------------------------------------------------- template< class _TPolyLine, class _TCurve > cpExtensions::Algorithms::PolyLineParametricPathToSimple3DCurve< _TPolyLine, _TCurve >:: ~PolyLineParametricPathToSimple3DCurve( ) { } // ------------------------------------------------------------------------- template< class _TPolyLine, class _TCurve > void cpExtensions::Algorithms::PolyLineParametricPathToSimple3DCurve< _TPolyLine, _TCurve >:: GenerateData( ) { const _TPolyLine* line = this->GetInput( ); _TCurve* curve = this->GetOutput( ); unsigned long N = this->m_NumberOfSamples; if( N == 0 ) N = line->GetSize( ); curve->Clear( ); for( unsigned long n = 0; n < N; ++n ) { double u = double( n ) / double( N - 1 ); curve->AddPoint( line->GetSmoothPoint( u ) ); } // rof } // ------------------------------------------------------------------------- #include #include template class cpExtensions::Algorithms::PolyLineParametricPathToSimple3DCurve< cpExtensions::DataStructures::PolyLineParametricPath< 3 >, cpExtensions::DataStructures::Simple3DCurve< float > >; template class cpExtensions::Algorithms::PolyLineParametricPathToSimple3DCurve< cpExtensions::DataStructures::PolyLineParametricPath< 3 >, cpExtensions::DataStructures::Simple3DCurve< double > >; // eof - $RCSfile$