34 #ifndef AIMS_MESH_CUTMESH_D_H 
   35 #define AIMS_MESH_CUTMESH_D_H 
   45     const std::vector<const AimsSurfaceTriangle *> & insurf,
 
   48     : 
CutMesh( insurf, plane ), _intex( intex )
 
   55     const std::vector<const AimsSurfaceTriangle *> & insurf,
 
   77     _intex.resize( intex.size(), std::vector<
const TimeTexture<T> *>() );
 
   78     typename std::vector<std::vector<
 
   81     typename std::vector<std::vector<const TimeTexture<T> *> >::iterator ipt;
 
   82     typename std::vector<carto::rc_ptr<TimeTexture<T> > >::const_iterator
 
   85     for( it=intex.begin(), ipt=_intex.begin(); it!=et; ++it, ++ipt )
 
   86       for( iit=it->begin(), eit=it->end(); iit!=eit; ++iit )
 
   87         ipt->push_back( iit->get() );
 
  100   template <
typename T>
 
  104     _cuttex.resize( _insurf.size() );
 
  105     unsigned i, n = _intex.size();
 
  106     if( n > _insurf.size() )
 
  109       _cuttex[i].resize( _intex[i].size(),
 
  115   template <
typename T>
 
  118     std::vector<const TimeTexture<T> *> & itexs = _intex[ mesh ];
 
  119     std::vector<carto::rc_ptr<TimeTexture<T> > > & otexs = _cuttex[ mesh ];
 
  120     typename std::vector<const TimeTexture<T> *>::const_iterator
 
  121       itex, etex = itexs.end();
 
  122     typename std::vector<carto::rc_ptr<TimeTexture<T> > >::iterator otex;
 
  125     for( itex=itexs.begin(), otex=otexs.begin(); itex!=etex; ++itex, ++otex )
 
  127       const Texture<T> & tex = (*itex)->begin()->second;
 
  136     template <
typename T>
 
  137     inline T _interpol( 
const T & v1, 
float w1, 
const T & v2, 
float w2 )
 
  139       return ( v1 * w1 + v2 * w2 ) / ( w1 + w2 );
 
  144     inline int32_t _interpol( 
const int32_t & v1, 
float w1,
 
  145                               const int32_t & v2, 
float w2 )
 
  147       return int32_t( rint( ( v1 * w1 + v2 * w2 ) / ( w1 + w2 ) ) );
 
  152     inline int16_t _interpol( 
const int16_t & v1, 
float w1,
 
  153                               const int16_t & v2, 
float w2 )
 
  155       return int16_t( rint( ( v1 * w1 + v2 * w2 ) / ( w1 + w2 ) ) );
 
  160     inline uint32_t _interpol( 
const uint32_t & v1, 
float w1,
 
  161                                const uint32_t & v2, 
float w2 )
 
  163       return uint32_t( rint( ( v1 * w1 + v2 * w2 ) / ( w1 + w2 ) ) );
 
  168     inline uint16_t _interpol( 
const uint16_t & v1, 
float w1,
 
  169                                const uint16_t & v2, 
float w2 )
 
  171       return uint16_t( rint( ( v1 * w1 + v2 * w2 ) / ( w1 + w2 ) ) );
 
  179       return ( v1 * w1 + v2 * w2 ) / ( w1 + w2 );
 
  185   template <
typename T>
 
  189     std::vector<const TimeTexture<T> *> & itexs = _intex[ mesh ];
 
  190     std::vector<carto::rc_ptr<TimeTexture<T> > > & otexs = _cuttex[ mesh ];
 
  191     typename std::vector<const TimeTexture<T> *>::const_iterator
 
  192       itex, etex = itexs.end();
 
  193     typename std::vector<carto::rc_ptr<TimeTexture<T> > >::iterator otex;
 
  196     for( itex=itexs.begin(), otex=otexs.begin(); itex!=etex; ++itex, ++otex )
 
  198       const Texture<T> & tex = (*itex)->begin()->second;
 
  199       (**otex)[0].
push_back( _interpol( tex[v], w1, tex[w], w2 ) );
 
void push_back(const T &item)
virtual ~CutTexturedMesh()
void setTextures(const std::vector< std::vector< carto::rc_ptr< TimeTexture< T > > > > &intex)
virtual void addTextureInterpolPoint(int mesh, uint v, float w1, uint w, float w2)
this callback is called to handle textures: add tex corresponding to an interpolation between two ver...
virtual void initializeOutputTextures()
virtual void addTexturePoint(int mesh, uint v)
this callback is called to handle textures: add tex corresponding to a vertex in the given mesh
CutTexturedMesh(const std::vector< const AimsSurfaceTriangle * > &insurf, const std::vector< std::vector< const TimeTexture< T > * > > &intex, const Point4df &plane)
The class for EcatSino data write operation.