Are the cone and sphere intersecting correctly in my code?

AI Thread Summary
The discussion focuses on detecting intersections between a cone and a sphere using a specific algorithm. The user is experiencing inconsistencies in intersection results, suggesting potential issues with either the code or the underlying mathematical principles. They have identified that the problem may relate to finding the closest point on the cone to the sphere's center, which is crucial for determining intersection based on the sphere's radius. The user seeks assistance in calculating this closest point, emphasizing the importance of the sphere's position relative to the cone. Overall, the thread highlights challenges in geometric intersection detection in programming.
chrom68
Messages
12
Reaction score
0
I am looking to test detect if a cone (described by an apex, angle theta and axis) and a sphere (defined by a sphere centre and a radius) intersect.

Please see here for a complete description (because i can't post the code here):

http://www.gamedev.net/community/forums/topic.asp?topic_id=513868

I am having trouble doing a simple test using this algorithm at the bottom of the link, which brings into question either the code or the validity of the math principles used. Intersections and Misses of the cone and sphere detections aren't consistent. Any advice on what is wrong with the math or the code?
 
Mathematics news on Phys.org
I've narrowed down the problem to looking for the closest point on the cone, to the sphere's centre (most likely a perpendicular distance away). The sphere's centre could be inside or outside the cone, hence the radius is the key to knowing whether there is an intersection or not. I've performed a test which allows me to do this, so now i need some help on getting the closest point.
 
Seemingly by some mathematical coincidence, a hexagon of sides 2,2,7,7, 11, and 11 can be inscribed in a circle of radius 7. The other day I saw a math problem on line, which they said came from a Polish Olympiad, where you compute the length x of the 3rd side which is the same as the radius, so that the sides of length 2,x, and 11 are inscribed on the arc of a semi-circle. The law of cosines applied twice gives the answer for x of exactly 7, but the arithmetic is so complex that the...
Back
Top