D
Dennis
Hi
I have a little problem as stated above (haven't found any solution on
the www). I have a list of objects (particles) where I have a member
of a template vector (array1d from TNT). I initialise these members in
the constructor, but when I write different vector values to different
particles the values becomes the same.
I have found out that each particles vector are pointing to the same
address (
When I used an array instead of a template there where no problem. How
do I initialise the template vector so each particle has it's own
template vector ??
Here are some snippets of code, which might be more understandable
than my rambling:
typedef TNT::Array1D<double> dVector3;
//typedef double dVector3[3];
enum orient {eHoris, eVertic};
//-----------------------------
typedef struct sParticle{
dVector3 position; //position of particle
sParticle()osition(3)
{
}
}
list<sParticle> particlePool;
particlePool.resize(noParticles);
for(k=0;k<emitNoParticles;k++){
(*emit_iterator).position[0] = k++
}
this works when i use my array vector, but when using the Array1D
vector the position vector points to the same address for all
particles.
How do I ensure that each particle has its own vector ?
Thanks for your help
Dennis
I have a little problem as stated above (haven't found any solution on
the www). I have a list of objects (particles) where I have a member
of a template vector (array1d from TNT). I initialise these members in
the constructor, but when I write different vector values to different
particles the values becomes the same.
I have found out that each particles vector are pointing to the same
address (
When I used an array instead of a template there where no problem. How
do I initialise the template vector so each particle has it's own
template vector ??
Here are some snippets of code, which might be more understandable
than my rambling:
typedef TNT::Array1D<double> dVector3;
//typedef double dVector3[3];
enum orient {eHoris, eVertic};
//-----------------------------
typedef struct sParticle{
dVector3 position; //position of particle
sParticle()osition(3)
{
}
}
list<sParticle> particlePool;
particlePool.resize(noParticles);
for(k=0;k<emitNoParticles;k++){
(*emit_iterator).position[0] = k++
}
this works when i use my array vector, but when using the Array1D
vector the position vector points to the same address for all
particles.
How do I ensure that each particle has its own vector ?
Thanks for your help
Dennis