Hi all
I started this thread on XSI Base, but it is still kinda hard to find the answer: http://www.xsibase.com/forum/index.php? ... adid=46119
the desired result is a flag on every inside particle, so I can delete it afterwards.
thx if anyone can give a help.
Test a bounding box for every particle
-
edschiffer
- Posts: 21
- Joined: 11 May 2011, 15:02
- Location: Rio de Janeiro
-
xsisupport
- Posts: 713
- Joined: 09 Jun 2009, 09:02
- Location: Montreal Canada
Re: Test a bounding box for every particle
I don't quite understand why you need to do this bounding box test.
Can't you do this at emit/creation time...don't emit particles so close to each other?
(the examples on the xsibase thread were using Generate 3d Point Grid, so the spacing was under your control)
Also, if particle N is inside the bounding box of particle M, then isn't particle M is inside the bounding box of particle N too? Which one are you going to delete? Aren't they both inside particles?
You're doing this test for every point, so you're going to get arrays per point.
Can't you do this at emit/creation time...don't emit particles so close to each other?
(the examples on the xsibase thread were using Generate 3d Point Grid, so the spacing was under your control)
Also, if particle N is inside the bounding box of particle M, then isn't particle M is inside the bounding box of particle N too? Which one are you going to delete? Aren't they both inside particles?
You're doing this test for every point, so you're going to get arrays per point.
-
edschiffer
- Posts: 21
- Joined: 11 May 2011, 15:02
- Location: Rio de Janeiro
Re: Test a bounding box for every particle
hey Stephen
what I want is to mark which particles are inside the 3d grid, so I can delete them and have a shell of remaining particles.
the thing is that when the particles are cubes, the cutoff distance of Get Closest Neighbors works great, because I test if they find 8 neighbors within a known radius. but when the particles dimensions are not so uniform, like 10x1x2 units for instance, the distance to particles aside are very different from the ones on top, etc. I guess that instead of a radius, I would test a bounding box for every particle the same size as the shape they'll have, if they find 8 particles within this box, it means they're surrounded and should be marked for deletion...
what I want is to mark which particles are inside the 3d grid, so I can delete them and have a shell of remaining particles.
the thing is that when the particles are cubes, the cutoff distance of Get Closest Neighbors works great, because I test if they find 8 neighbors within a known radius. but when the particles dimensions are not so uniform, like 10x1x2 units for instance, the distance to particles aside are very different from the ones on top, etc. I guess that instead of a radius, I would test a bounding box for every particle the same size as the shape they'll have, if they find 8 particles within this box, it means they're surrounded and should be marked for deletion...
-
xsisupport
- Posts: 713
- Joined: 09 Jun 2009, 09:02
- Location: Montreal Canada
-
edschiffer
- Posts: 21
- Joined: 11 May 2011, 15:02
- Location: Rio de Janeiro
Re: Test a bounding box for every particle
Stephen, this is a good compound, I'll keep it close, but actually doesn't solve what I had in mind: see, it's not always going to be a cube, but any geometry. it's actually a better "hollow" mode for my Legolize compound, to transform geometry into Lego bricks...
so I used a modified Generate 3d Grid to fill the volume of the bounding box of the given geometry;
deletes the points outside the given geometry;
and only then I would have a compound to delete the inside bricks.
it is currently working fine when the brick is more spherical, like a 4x4, but when it gets elongate, would be nice to test the actual brick BB for every particle...
so I used a modified Generate 3d Grid to fill the volume of the bounding box of the given geometry;
deletes the points outside the given geometry;
and only then I would have a compound to delete the inside bricks.
it is currently working fine when the brick is more spherical, like a 4x4, but when it gets elongate, would be nice to test the actual brick BB for every particle...
-
xsisupport
- Posts: 713
- Joined: 09 Jun 2009, 09:02
- Location: Montreal Canada
Re: Test a bounding box for every particle
How will you use the particle bounding-box test to determine whether a particle is inside or outside? (maybe it is because I'm on vacation, but I didn't see an obvious way 
If your compound uses an actual geometry to build the lego version, then maybe do something with raycasting?
If your compound uses an actual geometry to build the lego version, then maybe do something with raycasting?
-
edschiffer
- Posts: 21
- Joined: 11 May 2011, 15:02
- Location: Rio de Janeiro
Re: Test a bounding box for every particle
I'm thinking if a particle finds 26 particles inside the given bounding box, then mark it...
maybe testing if a particle finds others in +X, -X, +Y, -Y, +Z and -Z would also work, but this way any offset in the rows wouldn't probably work.
thx for taking the time, Stephen. this issue is the only thing left for me to release the compound. kinda annoying.
maybe testing if a particle finds others in +X, -X, +Y, -Y, +Z and -Z would also work, but this way any offset in the rows wouldn't probably work.
thx for taking the time, Stephen. this issue is the only thing left for me to release the compound. kinda annoying.