Sign in to follow this  

Ray - cone intersection

This topic is 4600 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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:- www.bmsc.washington.edu/people/merritt/graphics/quadrics.html Which doesn't go into much detail. Can anyone please help?

Share this post


Link to post
Share on other sites
One reference on the topic can be found here.

This particular algorithm intersects a linear component with an infinite cone represented by an origin, a unit-length axis, and the angle between the axis and the cone wall. You end up with a quadratic that you can solve using the usual methods to find the points of intersection.

For your purposes you may have to adapt this algorithm a little. Ignoring the truncated aspect for the moment, you may be representing your cone with a length from tip to base and a radius at the base, rather than with an interior angle. If so, you can replace the cos(theta)2 terms in the quadratic with:

length2/(radius2+length2)

For a capped (not infinite) cone, you have to catch the cases where the ray passes through the cap and find those intersection points as well. Additionally there are a few degenerate cases that must be handled, such as the ray lying in or running parallel to the cone wall.

Truncating the top of the cone adds further complexity. One solution would be to find the point along the cone axis where the radius of the infinite cone equals the smaller of your two cone radii. This then becomes another clipping plane for the ray, and another endcap with which you must intersect.

At the moment I happen to be working on code for intersection of a linear component and a cone (capped, but not truncated). I'm not done with it yet, otherwise I'd post the code for you. But since I'm also working on this problem, I'll be glad to offer further help if you get stuck.

(Also, it looks like you're interested in a boolean-only test. If you don't need the actual points of intersection, the code can be simplified somewhat.)

Share this post


Link to post
Share on other sites

This topic is 4600 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this