[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Triangle-Triangle Intersection Tests

Miguel A. Osorio wrote:

Hey people,

	I just recently finished coding my version of the algorithm for
triangle-triangle intersection presented in the ERIT package (I got the
algorithm outline in the book "Real-Time Rendering" from Moller and
Haines, 2nd ed.). I believe it's working properly, but I'm not sure of
it's efficiency. On some preliminary tests, I got a considerable lagging
in the frame rate as soon as the triangle intersection tests kicked in.
	I use an OBB tree for visibility and collision-detection. So, in the
OBB collision tests, as soon as I reach the situation of two leafs
intersecting, I head on to test all faces of one leaf with all faces of
the other. Faces from leaf A are put into the coordinate system of leaf
B and tested for intersection.
	Here are my questions: first, am I doing anything very wrong to begin
with? Second, I know triangle intersection tests are not magic, but has
anyone an idea of just how many triangles could be tested without
significantly hindering the application performance, for say, an
equivalent to a Pentium III 800Mhz? How do I measure the performance of
my implementation of the ERIT algorithm, since, of course, I could have
coded a bad version?
	Well, I may seem kind of lost in the park here, but the thing is, I
didn't expect the performance hit to be so big :) Oh, and one last
thing: if anyone wants to take a look at my code, just let me know.

Thank you for your attention,
Miguel A. Osorio.

Why don't you use one of the collision detection libs that are already out there? There's SOLID, RAPID and OpCode to name only a few of them. These are highly optimized (and most of them seem to use layered sets of algorithms to avoid triangle-triangle-checks on almost every available combination).

Opcode homepage: http://www.codercorner.com/Opcode.htm

If you follow a few links from there you'll find a lot of algrithms and implementations readily available.