Benchmarking - segment/triangles

Mitox
Posts: 6
Joined: Mon Jan 12, 2009 10:07 am

Benchmarking - segment/triangles

Post by Mitox »

Hello (I don't now if I choose the best location to post.. but I hope so !)

I would like to make a benchmark between bullet and an other collision detection algorithm. I just would like to know if bullet has the possibility to test : segment - triangles collision.
From my first contact with bullet I saw "Raycast" may -kind of- suit for my tests, but in my situation the ray has only a limited length, is there some Demo/code I should look at for a more precise benchmark ?

Thank you in advance for any answer !
User avatar
Erwin Coumans
Site Admin
Posts: 4221
Joined: Sun Jun 26, 2005 6:43 pm
Location: California, USA

Re: Benchmarking - segment/triangles

Post by Erwin Coumans »

The btCollisionWorld::btRayTest is actually a segment with a start and end, and it returns the first hit and hit point/normal.

This is different from a segment/triangle test, that returns the penetration depth/normal. You can use a btMultiSphereShape with 2 spheres of radius 0 (and set collision margon to zero) to emulate a ray segment for this test.

What kind of query do you perform between segment and triangle? hit fraction or penetration depth?
Thanks,
Erwin
Mitox
Posts: 6
Joined: Mon Jan 12, 2009 10:07 am

Re: Benchmarking - segment/triangles

Post by Mitox »

I'm doing continuous collision detection with particles, and I interpolate the trajectory by a line to find if there was a hit point during the displacement.
From what you told me I think the btCollisionWorld::btRayTest match what I want
(I assumed the continuous detection collision in bullet only considered triangles/triangles intersection as other libraries do, so the triangle/triangle intersection tests would be "overevaluated" compared to the method I want to benchmark)

Thanks,

Thomas
Mitox
Posts: 6
Joined: Mon Jan 12, 2009 10:07 am

Re: Benchmarking - segment/triangles

Post by Mitox »

I'm coming back about my benchmarking !

I integrated bullet in my application following the example of "ConcaveRaycastDemo", but I've got some incoherent results reporting collision when there is none (just sometimes not everytime, that's the most disturbing..).

So my questions are :
- Does the "raytest" works fine when the ray is totally included in a closed triangulated environment ?
- Is there some conditions on the ray, about the length maybe ?

Some particularity of my code (even if I don't think it can be part of my problem) :
- each vertex appears in the btTriangleIndexVertexArray multiple times (each time there is a triangle they are a part of)


Thanks again,

Thomas
User avatar
Erwin Coumans
Site Admin
Posts: 4221
Joined: Sun Jun 26, 2005 6:43 pm
Location: California, USA

Re: Benchmarking - segment/triangles

Post by Erwin Coumans »

I've got some incoherent results reporting collision
The rayTest should work in most cases, except for degenerate triangles or extreme ray length.
Can you provide a reproduction case that shows the incoherent results in one of the Bullet demos?

Thanks,
Erwin
Mitox
Posts: 6
Joined: Mon Jan 12, 2009 10:07 am

[Solved] Benchmarking - segment/triangles

Post by Mitox »

It was my fault, I gave a vertexStride with the gmtl vectors size instead of the btVector3.. so there was a problem with the triangle array of course..

It works great now !

Thanks,
Thomas