cone/plane intersection test

Started by
4 comments, last by Kwizatz 15 years, 9 months ago
Hi, I'm looking for help in writing a plane/cone intersection test, and can't seem to find anything helpful on google or the forums :( Has anyone got any info that could help me out? Thanks, Hybrid
Advertisement
How are you defining the cone?
Well, it's representing a spot light, so I guess ideally that makes it a sphere-segment, clipped based on an angle in radians.

I was thinking about a flat capped cone/plane test when i posted first time around.. but that would become increasingly inaccurate for wider and wider cones...

So i guess what I need is:

- a sphere/plane test for the distance culling part (i can do that bit ;))
- a test for an infinite cone (using an axis/angle) against the plane
- a test that the nearest intersection point was within the radius used in the first test


[Edited by - Hybrid666 on June 30, 2008 11:09:40 AM]
I think (but I am just speculating here) that if what you want is the projection of a cone of light on the plane, you probably have to think about it parametrically.

If you only need to know if a plane and a cone intersect, I would create a ray from the origin of the cone in the direction of half the aperture angle in such a way that the origin-direction origin-ray "triangle"'s normal is perpendicular to the plane normal, and then just do a ray plane test.

Hope that is understandable, basically what you want is a ray that goes through the cone's origin and the closest point in the cone's disk to the plane, you'd use a segment instead of a ray if the cone is not infinite.

Hope that helps.

[Edited by - Kwizatz on July 2, 2008 11:41:42 AM]
Hi,

thanks for the reply, that makes sense and will work for a capped or infinite cone.

but if my cone has a rounded cap (the perimeter of the sphere formed N units from the cone centre) and the cone points roughly at the plane, this test wont work.. any ideas for how to solve that?

......./\.
....../..\.
...../....\.
..../......\.
.../........\.
...`.___.
---------------

that's some ace ascii art if i do say so myself :) hopefully it conveys my point:
the line intersection test would fail if the plane intersected only the "curved bit" at the end of the cone. i suppose this shape I'm talking about isn't technically a cone anymore.. but i don't know what it's called..

thanks for the help so far
Well, in that case you have to test the sphere against the plane as well, that one is a very simple check, if the distance from the plane to the sphere origin is less than the radius of the sphere, there is an intersection.

Of course you'd have add guards so you only report an intersection on the half sphere at the end of the cone, and not the half that resides inside the cone, you could do that by calculating the dot product of the vectors destination-origin (IE: cone direction) of the cone and "sphere origin" - "closest point in plane to sphere origin" (IE: direction from plane to sphere), if the result is negative then you know the contact will be on the right half of the sphere.

I am assuming you are interested on intersections from both sides of the plane here, if not, then you have to pay more attention to the plane normal, but nothing too complicated.

This topic is closed to new replies.

Advertisement