Question to Christer Ericson about Collision

Started by
2 comments, last by Zakwayda 15 years, 3 months ago
Hello Christer, How are you? While I was reading your book Real-time Collision Detection, I get confused with one thing here and i wanted to give you one question about what i was thinking. 1. On page 149 there is a code of Closest Point of 2 Segments. You used here EPSILON which i think is equal to 0.001. Why you didn't used here if(a == 0) but used if(a < EPSILON)? 2. Is it possible to test Collision of Capsule or Lozenge with OBB? If yes, How can i do it? Thanks in Advance, Kasya
Advertisement
Quote:Original post by Kasya
Hello Christer,
How are you? While I was reading your book Real-time Collision Detection, I get confused with one thing here and i wanted to give you one question about what i was thinking.

1. On page 149 there is a code of Closest Point of 2 Segments. You used here EPSILON which i think is equal to 0.001. Why you didn't used here if(a == 0) but used if(a < EPSILON)?

2. Is it possible to test Collision of Capsule or Lozenge with OBB? If yes, How can i do it?

Thanks in Advance,
Kasya
Hi Kasya,

Christer does post here occasionally, but I wouldn't count on him seeing this particular post (although he may). However, there are a lot of people on the forums who can answer collision detection-related questions, so you should be able to get answers to your questions one way or another.

Checking the page in question, it looks like you're referring to the check for near-zero-length line segments. The problem here is a fundamental one, and one that you'll need to understand in order to make sense of much of the code in Christer's book, or for that matter any code that deals with collision detection or other geometrical algorithms.

You should give Chapter's 11 and 12 in the aforementioned book a read before proceeding too much further; you might also give this a read.

I only glanced at the code you're asking about, but it appears to me that in this case the epsilon check is intended to avoid division by numbers with very small magnitude, which, while perfectly acceptable in the world of real numbers, can cause problems with overflow and precision when working with floating-point representations of real numbers.

As for your other question, the static versions of these tests can be expressed as closest-point queries between a line segment and a box (capsule vs. OBB) and a rectangle and a box (lozenge vs. OBB). The dynamic versions are trickier - the first algorithm that comes to mind is the continuous GJK test (which is non-trivial).

Generally speaking, capsule- and lozenge-vs.-OBB tests are among the more difficult tests to implement, so you might consider going with an easier alternative (such as OBB vs. OBB).
Hello jyk,
Thank you very very much for your help! I got only one question here. I read capsule and lozenge collision tests are good for Physics Systems (Physical Collision Responses). I know have Sphere-Sphere, OBB-OBB and Sphere-OBB Collision Tests. I wanted to add Capsule and Lozenge to my Collision System. But from your reply i see that it is very expensive to use Tests with Capsule and Lozenge. I just want to know, Do i need Capsule, Lozenge tests if i have the Tests above? If yes, in what type of objects? Only with Barrels?

Kasya
Quote:Original post by Kasya
Hello jyk,
Thank you very very much for your help! I got only one question here. I read capsule and lozenge collision tests are good for Physics Systems (Physical Collision Responses). I know have Sphere-Sphere, OBB-OBB and Sphere-OBB Collision Tests. I wanted to add Capsule and Lozenge to my Collision System. But from your reply i see that it is very expensive to use Tests with Capsule and Lozenge. I just want to know, Do i need Capsule, Lozenge tests if i have the Tests above? If yes, in what type of objects? Only with Barrels?

Kasya
There's no one right answer to the question of what primitives one 'needs' to support in their physics engine. It depends on many factors: the nature of the simulation, how much accuracy you need, how much time you can afford to spend researching, coding, testing, and debugging, and so forth. In other words, it's up to you.

Static capsule- and lozenge-vs.-OBB tests probably aren't that bad, expense-wise, but I've never bothered with these particular tests myself. I can tell you that capsules are much easier to work with than cylinders, so if it comes down to one of those two primitives, go with capsules.

This topic is closed to new replies.

Advertisement