# Ray - cone intersection

Hi,

I’m trying to come up with a technique for determining whether a ray intersects a cone. The cone is truncated, i.e. one of the ends does not necessarily have a radius of zero, and the cone is not based at the origin.
I’m having real trouble with this at the moment because I’ve been unable to locate any really useful resources on the net and there aren’t any similar topics on this forum. The best thing I’ve found so far is the following:-

I cant code this up myself atm, cuz i have too many assignments due:P But I was thinking that you maybe should try and think about it in terms of two discs, and approximate the sides of the cone with triangles. Using the origin of the ray, and the origin of the cone, you can calculate the approximate angle from which side the ray is approaching, which gives you a possible intersection between +/- pi/2 rads relative to the calculated angle. You can further narrow it down if you like by maybe finding the projection of the ray onto the vector from the start of the ray to the base of disc. (Note: that you are only interested in the x and y componenet.)

For this to work you would probably have to first make the cone axis alligned, then transform it until it fits the shape perfectly. Since the sides of the cone is then aproximated with triangles it should be straigh forward enought to find the intersection.

However, if you ask me this method of collision detection would be pretty slow. Why dont you just make a really low polygon model of the model you want to test for collision and just test your ray agains that? (ps, you still render the high polygon model, but you do collision detection on the low polygon model.) This method would prob be just as fast as the method above, but you can perfectly place the boudning volumes in max, and just test against that. This would probably give you the highest resolution collision detection.

Hope that made atleast a little sense.

Originally posted by ramsey:
[b]Hi,

I’m trying to come up with a technique for determining whether a ray intersects a cone. The cone is truncated, i.e. one of the ends does not necessarily have a radius of zero, and the cone is not based at the origin.
I’m having real trouble with this at the moment because I’ve been unable to locate any really useful resources on the net and there aren’t any similar topics on this forum. The best thing I’ve found so far is the following:-