kd-tree and sph
Mickael POUCHOL
mickael.pouchol at xlim.fr
Mon Mar 10 09:38:42 UTC 2008
Hi,
I'm using libkdtree++ for 2D SPH simulation for nearest neighbour
search. The structure stored in the kd-tree is :
struct ParticlePtr {
typedef float value_type;
inline value_type operator[](size_t const N) const { return
ptr->position[N]; }
// The position if of type vec2f
Particle *ptr;
};
For each particle in the simulation, I use the tree to get its
neighbours with a call to : t.find_within_range(current_particle, RANGE,
std::back_inserter(v));
Sometimes I would like to query the tree with a vec2f value and not with
a ParticlePtr. Is there a way to do that?
Secondly I would like to use another kd-tree to store segments (or
triangles in 3D) and query it with a ray in the collision detection
phase. I didn't not understand how to define such a kd-tree with the lib.
Thanks for your help,
Mickael
More information about the libkdtree-devel
mailing list