34 #ifndef AIMS_TEXDATA_TEXDATA_H
35 #define AIMS_TEXDATA_TEXDATA_H
68 typedef std::pair<Point3df,uint>
type;
118 const Site operator *() {
return std::pair<Point3df,uint>((*_coordinates)[ _index], _index); }
129 std::vector<Point3df> *_coordinates;
174 TexturedData(
int dimx,
int dimy,
int dimz,
int dimt = 1,
187 int NbSites() {
return (_data->getSizeX()*_data->getSizeY()*_data->getSizeZ());}
219 _mesh(mesh), _tex(tex), _coordinates(coords) { }
228 writerT.
write(timetext);
239 int NbSites() {
return _mesh->vertex().size(); }
244 std::vector<std::set<uint> > _allNeighbours;
245 std::vector<Point3df> *_coordinates;
254 template<
typename T>
bool
257 if ((_pos[0]==other._pos[0]) && (_pos[1]==other._pos[1]) && (_pos[2]==other._pos[2]))
return true;
261 template<
typename T>
bool
264 if ((this->_pos[0] != other._pos[0]) || (this->_pos[1] != other._pos[1]) || (this->_pos[2] != other._pos[2]))
return true;
271 if (this->_index == other._index)
return true;
278 if (this->_index != other._index)
return true;
293 if ( _pos[0] < (_data->getSizeX() -1) )
295 else if ( _pos[1] < (_data->getSizeY() -1) )
314 else if ( _pos[1] > 0 )
316 _pos[0]=(_data->getSizeX() -1);
321 _pos[0]=(_data->getSizeX() -1);
322 _pos[1]=(_data->getSizeY() -1);
335 _coordinates = (std::vector<Point3df> *)(&(data->
vertex()));
343 _coordinates = coords;
367 *((*this)._data)=(*(other._data)).
copy();
388 Point3d point(0, 0, _data->getSizeZ());
394 template<
typename T> std::vector<typename SiteType<carto::VolumeRef<T> >::type>
398 std::vector<Point3d> neigh;
399 int x=pos[0], y=pos[1], z=pos[2];
403 for (i=-1; i<=1; i=i+1)
404 for (j=-1; j<=1; j=j+1)
405 for (k=-1; k<=1; k=k+1)
407 if ((i!=0) || (j!=0) || (k!=0))
409 if ( ((x+i)>=0) && ((x+i)<_data->getSizeX()) && ((y+j)>=0) && ((y+j)<_data->getSizeY()) && ((z+k)>=0) && ((z+k)<_data->getSizeZ()) )
414 neigh.push_back(point);
421 template<
typename T> T &
424 return (*_data)(pos);
427 template<
typename T>
const T &
430 return (*_data)(pos);
435 template<
int D,
class T>
440 if (other._coordinates != NULL ){
441 (*this)._coordinates = other._coordinates;
444 (*this)._coordinates=NULL;
452 if (_coordinates == NULL) {
465 if (_coordinates == NULL ) {
475 template<
int D,
class T>
476 std::vector<typename SiteType<AimsSurface<D,Void> >::type>
481 if (_allNeighbours.size()==0)
483 _allNeighbours=std::vector<std::set<uint> >( (*_mesh).vertex().size());
484 n=(*_mesh).polygon().
size();
489 _allNeighbours[(*_mesh).polygon()[i][j]].insert( (*_mesh).polygon()[i][k] );
492 std::vector<Site> out;
493 std::set<uint>::iterator ptNeigh=_allNeighbours[pos.second].begin();
495 for ( ; ptNeigh != _allNeighbours[pos.second].end() ; ++ptNeigh)
496 out.push_back(std::pair<Point3df,uint>(_mesh->vertex()[*ptNeigh], *ptNeigh));
502 template<
int D,
class T> T &
505 return((*_tex).item(pos.second));
508 template<
int D,
class T>
const T &
511 return((*_tex).item(pos.second));
518 (*(*this)._data)=(*(other._data)).
copy();
525 (*this)._mesh=other._mesh;
526 (*this)._tex=other._tex;
527 if (other._coordinates != NULL){
528 (*this)._coordinates=other._coordinates;
531 (*this)._coordinates=NULL;
The template class to manage a mesh.
const std::vector< Point3df > & vertex() const
Get a const reference to the vector of vertices.
SiteType< AimsSurface< D, Void > >::type Site
SiteType< carto::VolumeRef< T > >::type Site
bool operator!=(const SiteIterator< S > &other) const
SiteIterator< S > & operator--()
bool operator==(const SiteIterator< S > &other) const
SiteIterator< S > & operator++()
std::pair< Point3df, uint > type
size_t size() const
alias for nItem()
TexturedData(AimsSurface< D, Void > *mesh, Texture< T > *tex)
AimsSurface< D, Void > * GetMesh()
SiteType< AimsSurface< D, Void > >::type Site
Texture< T > * GetTexture()
TexturedData(AimsSurface< D, Void > *mesh, Texture< T > *tex, std::vector< Point3df > *coords)
SiteType< carto::VolumeRef< T > >::type Site
TexturedData(carto::VolumeRef< T > *data)
carto::VolumeRef< T > * GetImage()
TexType< Text >::type Tex
SiteIterator< Geom > siteBegin()
SiteIterator< Geom > siteEnd()
SiteType< Geom >::type Site
std::vector< Site > neighbours(const Site &pos)
Tex & intensity(const Site &pos)
Generic writer for every format of Aims object.
virtual bool write(const T &obj, bool ascii=false, const std::string *format=0)
Finds the correct format and writes the object.
Volume< T > copy(const Volume< T > &src)