mesh inside mesh?

Blitz3D Forums/Blitz3D Programming/mesh inside mesh?

vivaigiochi(Posted 2007) [#1]
how can determine if a mesh is inside another mesh?


puki(Posted 2007) [#2]
That's an exciting question.

I assume you mean like completely inside another mesh - like a spaceship mesh inside a space station mesh?

I don't know - but If I had to work this out, I'd store centrepoints for each of the relevent meshes. If you know the centre-point of a mesh then you are halfway there.

I'd then store the width/height/depth of each relevent mesh - you now know its area.

Collisions and mesh intersection might be useless here if the containing mesh has a complex interior - so you might have to rely on purely *knowing* the mesh is inside (as per above) rather than knowing it it is inside the containing mesh whilst also not colliding or intersecting.

Someone else will probably come along and clarify that.


(tu) sinu(Posted 2007) [#3]
if the vertices are higher than the lowest verts, lower than the highest verts or less left/right then the mesh is completely inside the other mesh. Use tform commands to get global positions.
Should be some algorythm which would save checking every vert against every other vert.


Carrot(Posted 2007) [#4]
Step1: do a quick test by keeping bounding-box volumes for each mesh. You can then eliminate further tests very quickly.
otherwise:

Step2: assuming all the faces are facing outwards for each model, a quick dot-product calculation for each vertex will tell you if a vertex from model A is 'behind' a face of model B. If all faces are likewise, then model A is totally encompassed by model B

Look up dot-products and axes-aligned bounding boxes AABB

Hope this helps. I don't have time to expand further at the minute.
C.