Triangle mesh intersection

Post Reply
grsabourin
Posts: 3
Joined: Tue Apr 05, 2011 2:38 am

Triangle mesh intersection

Post by grsabourin »

Hi,

I would like to know what is the simplest way to compute intersection between a plane and a triangle mesh. Not only bounding box intersection, I need triangles intersection. Is it possible to do that with bullet.

Thank you
User avatar
dphil
Posts: 237
Joined: Tue Jun 29, 2010 10:27 pm
Contact:

Re: Triangle mesh intersection

Post by dphil »

Sure. You could do this by creating one rigid body from a btGImpactMeshShape (for a triangle mesh) and another from a btPlaneShape. If part of a dynamic simulation, you should get accurate triangle to plane collision detection. If you just want a one-time collision test for the two (at specific transforms), I suppose you could just use btCollisionWorld::contactPairTest(body1, body2, callBack).
grsabourin
Posts: 3
Joined: Tue Apr 05, 2011 2:38 am

Re: Triangle mesh intersection

Post by grsabourin »

Thank you, I will try that and I will give you feedback
User avatar
dphil
Posts: 237
Joined: Tue Jun 29, 2010 10:27 pm
Contact:

Re: Triangle mesh intersection

Post by dphil »

I should probably mention, for proper collision detection with btGimpactMeshShapes, you also need to make sure to register the gimpact algorithm by calling the following code after you create your world (or at least the dispatcher your world uses):

Code: Select all

btGImpactCollisionAlgorithm::registerAlgorithm(dispatcher)
grsabourin
Posts: 3
Joined: Tue Apr 05, 2011 2:38 am

Re: Triangle mesh intersection

Post by grsabourin »

Hi,

I tried to compute intersection between my triangular mesh and a btStaticPlane without lot of success. The output structure (btManifoldResult) is all the time empty. I mainly use the code in AppCollisionInterfaceDemo project ( CollisionInterfaceDemo.cpp line 285 ).

I have tried to replace the btStaticPlane by a box. I compute intersection between the box ( very thin box ) with my triangular mesh. With this setup I have a intersection of 4 points. I understand that this method compute intersection of the box side (arete) and the mesh. It is not really what I want. I`m looking for a method to compute a mesh slice. I need intersection between each point of the plane and the mesh.

Is it the right method? Is it possible with Bullet?

Thank you
samapico
Posts: 2
Joined: Thu Jan 17, 2013 10:12 pm

Re: Triangle mesh intersection

Post by samapico »

grsabourin wrote:Hi,

I tried to compute intersection between my triangular mesh and a btStaticPlane without lot of success. The output structure (btManifoldResult) is all the time empty. I mainly use the code in AppCollisionInterfaceDemo project ( CollisionInterfaceDemo.cpp line 285 ).

I have tried to replace the btStaticPlane by a box. I compute intersection between the box ( very thin box ) with my triangular mesh. With this setup I have a intersection of 4 points. I understand that this method compute intersection of the box side (arete) and the mesh. It is not really what I want. I`m looking for a method to compute a mesh slice. I need intersection between each point of the plane and the mesh.

Is it the right method? Is it possible with Bullet?

Thank you
I know this topic is very old, but it's a top result for my search, and we have pretty much the same need and issues...

Any update on this? How did you end up doing it?

We also don't need this for real-time collision check, so I'm starting to wonder if it would be simpler to just iterate through every triangle and check for intersection, but then we lose the octree that I assume bullet uses for these kinds of things. We might have to work with models with millions of polygons though, so iterating through every triangle could be expensive.

We're using a btTriangleMesh, a static plane and bullet 2.80
Post Reply