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;
147 std::vector<Site> neighbours(
const Site & pos );
148 Tex & intensity(
const Site & pos );
166 std::vector<Site> neighbours(
const Site & pos );
167 Tex & intensity(
const Site & pos );
168 const Tex & intensity(
const Site & pos )
const;
174 TexturedData(
int dimx,
int dimy,
int dimz,
int dimt = 1,
187 int NbSites() {
return (_data->dimX()*_data->dimY()*_data->dimZ());}
208 std::vector<Site> neighbours(
const Site & pos );
209 Tex & intensity(
const Site & pos );
210 const Tex & intensity(
const Site & pos )
const;
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->dimX() -1) )
295 else if ( _pos[1] < (_data->dimY() -1) )
314 else if ( _pos[1] > 0 )
316 _pos[0]=(_data->dimX() -1);
321 _pos[0]=(_data->dimX() -1);
322 _pos[1]=(_data->dimY() -1);
335 _coordinates = (std::vector<Point3df> *)(&(data->
vertex()));
343 _coordinates = coords;
367 *((*this)._data)=(*(other._data)).clone();
373 _data=
new AimsData<T>(dimx, dimy, dimz, dimt, borderw);
388 Point3d point(0, 0, _data->dimZ());
394 template<
typename T> std::vector<typename SiteType<AimsData<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->dimX()) && ((y+j)>=0) && ((y+j)<_data->dimY()) && ((z+k)>=0) && ((z+k)<_data->dimZ()) )
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)).clone();
525 (*this)._mesh=other._mesh;
526 (*this)._tex=other._tex;
527 if (other._coordinates != NULL){
528 (*this)._coordinates=other._coordinates;
531 (*this)._coordinates=NULL;
TexType< Text >::type Tex
AimsData< T > * GetImage()
SiteType< Geom >::type Site
const std::vector< Point3df > & vertex() const
Get a const reference to the vector of vertices.
TexturedData(AimsSurface< D, Void > *mesh, Texture< T > *tex)
TexturedData(AimsSurface< D, Void > *mesh, Texture< T > *tex, std::vector< Point3df > *coords)
Texture< T > * GetTexture()
SiteType< AimsData< T > >::type Site
TexturedData(AimsData< T > *data)
virtual bool write(const T &obj, bool ascii=false, const std::string *format=0)
Finds the correct format and writes the object.
AimsData< T > operator*(const AimsData< T > &firstThing, float scale)
AimsSurface< D, Void > * GetMesh()
The template class to manage a mesh.
SiteType< AimsData< T > >::type Site
Generic writer for every format of Aims object.
SiteType< AimsSurface< D, Void > >::type Site
SiteType< AimsSurface< D, Void > >::type Site
int operator==(const AimsBucketItem< T > &thing1, const AimsBucketItem< T > &thing2)
std::pair< Point3df, uint > type