00001 #ifndef INCLUDE_DILATOR_H
00002 #define INCLUDE_DILATOR_H
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036 #if defined(NO_TEMPLATE_MEMBERS)
00037 #include "PartialList.h"
00038 #endif
00039
00040 #include <vector>
00041
00042
00043 namespace Loris {
00044
00045 class Marker;
00046 class Partial;
00047
00048
00049
00050
00062
00063 class Dilator
00064 {
00065
00066
00067 std::vector< double > _initial, _target;
00068
00069
00070 public:
00071
00072
00074 Dilator( void );
00075
00091 #if ! defined(NO_TEMPLATE_MEMBERS)
00092 template<typename Iter1, typename Iter2>
00093 Dilator( Iter1 ibegin, Iter1 iend, Iter2 tbegin );
00094 #else
00095 inline
00096 Dilator( const double * ibegin, const double * iend, const double * tbegin );
00097 #endif
00098
00099
00100
00101
00102
00118 void insert( double i, double t );
00119
00120
00121
00144 void dilate( Partial & p ) const;
00145
00147 void operator() ( Partial & p ) const;
00148
00155 void dilate( Marker & m ) const;
00156
00158 void operator() ( Marker & m ) const;
00159
00173 #if ! defined(NO_TEMPLATE_MEMBERS)
00174 template<typename Iter>
00175 void dilate( Iter dilate_begin, Iter dilate_end ) const;
00176 #else
00177 inline
00178 void dilate( PartialList::iterator dilate_begin,
00179 PartialList::iterator dilate_end ) const;
00180 #endif
00181
00191 #if ! defined(NO_TEMPLATE_MEMBERS)
00192 template<typename Iter>
00193 void operator() ( Iter dilate_begin, Iter dilate_end ) const;
00194 #else
00195 inline
00196 void operator() ( PartialList::iterator dilate_begin,
00197 PartialList::iterator dilate_end ) const;
00198 #endif
00199
00204 double warpTime( double currentTime ) const;
00205
00206
00207
00232 #if ! defined(NO_TEMPLATE_MEMBERS)
00233 template< typename PartialsIter, typename TimeIter1, typename TimeIter2 >
00234 static
00235 void dilate( PartialsIter dilate_begin, PartialsIter dilate_end,
00236 TimeIter1 ibegin, TimeIter1 iend, TimeIter2 tbegin );
00237 #else
00238 static inline
00239 void dilate( PartialList::iterator dilate_begin,
00240 PartialList::iterator dilate_end,
00241 const double * ibegin, const double * iend,
00242 const double * tbegin );
00243 #endif
00244
00245 };
00246
00247
00248
00249
00250
00266
00267 #if ! defined(NO_TEMPLATE_MEMBERS)
00268 template<typename Iter1, typename Iter2>
00269 Dilator::Dilator( Iter1 ibegin, Iter1 iend, Iter2 tbegin )
00270 #else
00271 inline
00272 Dilator::Dilator( const double * ibegin, const double * iend, const double * tbegin )
00273 #endif
00274 {
00275 while ( ibegin != iend )
00276 {
00277 insert( *ibegin++, *tbegin++ );
00278 }
00279 }
00280
00281
00282
00283
00297
00298 #if ! defined(NO_TEMPLATE_MEMBERS)
00299 template<typename Iter>
00300 void Dilator::dilate( Iter dilate_begin, Iter dilate_end ) const
00301 #else
00302 inline
00303 void Dilator::dilate( PartialList::iterator dilate_begin,
00304 PartialList::iterator dilate_end ) const
00305 #endif
00306 {
00307 while ( dilate_begin != dilate_end )
00308 {
00309 dilate( *(dilate_begin++) );
00310 }
00311 }
00312
00313
00314
00315
00325
00326 #if ! defined(NO_TEMPLATE_MEMBERS)
00327 template<typename Iter>
00328 void Dilator::operator() ( Iter dilate_begin, Iter dilate_end ) const
00329 #else
00330 inline
00331 void Dilator::operator() ( PartialList::iterator dilate_begin,
00332 PartialList::iterator dilate_end ) const
00333 #endif
00334 {
00335 dilate( dilate_begin, dilate_end );
00336 }
00337
00338
00339
00340
00344
00345 inline
00346 void Dilator::operator() ( Partial & p ) const
00347 {
00348 dilate( p );
00349 }
00350
00351
00352
00353
00357
00358 inline
00359 void Dilator::operator() ( Marker & m ) const
00360 {
00361 dilate( m );
00362 }
00363
00364
00365
00366
00391
00392 #if ! defined(NO_TEMPLATE_MEMBERS)
00393 template< typename PartialsIter, typename TimeIter1, typename TimeIter2 >
00394 void Dilator::dilate( PartialsIter dilate_begin, PartialsIter dilate_end,
00395 TimeIter1 ibegin, TimeIter1 iend, TimeIter2 tbegin )
00396 #else
00397 inline
00398 void Dilator::dilate( PartialList::iterator dilate_begin,
00399 PartialList::iterator dilate_end,
00400 const double * ibegin, const double * iend,
00401 const double * tbegin )
00402 #endif
00403 {
00404 Dilator instance( ibegin, iend, tbegin );
00405 instance.dilate( dilate_begin, dilate_end );
00406 }
00407
00408 }
00409
00410 #endif