3D Collision Detection
How do you test if a plane or point interesects a point in a sphere in 3D. I want to use thsi to test for distance between a radius of an object sorta like a "AI" testing zone. But I don''t want the sphere visible. I will be using the OpenGL API using C++.
Don''t click me!
Killer Eagle Software
Gosh,
I'm going to give out this link for the fourth time today!
http://www.gamasutra.com/features/20020118/vandenhuevel_01.htm
Graham Rhodes
Senior Scientist
Applied Research Associates, Inc.
[edited by - grhodes_at_work on December 10, 2002 12:27:30 PM]
I'm going to give out this link for the fourth time today!
http://www.gamasutra.com/features/20020118/vandenhuevel_01.htm
Graham Rhodes
Senior Scientist
Applied Research Associates, Inc.
[edited by - grhodes_at_work on December 10, 2002 12:27:30 PM]
Graham Rhodes Moderator, Math & Physics forum @ gamedev.net
Oops,
I know that link isn''t all that relevant. But its a nice link, don''t you think?
Testing a point is easy. Just find the distance between the center of the sphere and the point. If the distance is equal to the radius (+/-) the point is on the sphere surface. If the distance is less than the radius then the point is in the sphere''s interior.
A plane is more complex, but not that complex. Do this:
1) Find the perpendicular distance from the center of the sphere to the plane
2) If that distance is equal to the sphere''s radius, the plane touches the sphere at a point. If the distance is less than the sphere''s radius, the plane cuts through the sphere.
These computations have absolutely nothing to do with what you draw. Of course, you could use the Jiffy-- programming language and "Alf''s 3D API" for all it matters,
.
Graham Rhodes
Senior Scientist
Applied Research Associates, Inc.
I know that link isn''t all that relevant. But its a nice link, don''t you think?
Testing a point is easy. Just find the distance between the center of the sphere and the point. If the distance is equal to the radius (+/-) the point is on the sphere surface. If the distance is less than the radius then the point is in the sphere''s interior.
A plane is more complex, but not that complex. Do this:
1) Find the perpendicular distance from the center of the sphere to the plane
2) If that distance is equal to the sphere''s radius, the plane touches the sphere at a point. If the distance is less than the sphere''s radius, the plane cuts through the sphere.
These computations have absolutely nothing to do with what you draw. Of course, you could use the Jiffy-- programming language and "Alf''s 3D API" for all it matters,

Graham Rhodes
Senior Scientist
Applied Research Associates, Inc.
Graham Rhodes Moderator, Math & Physics forum @ gamedev.net
Sorry cant resist and he might need it.
To find the perpendicular distance between a point and a plane:
1) Planes are usually defined by a normal vector and a point in space.
2) Ensure the plane''s normal vector is normalized(length fo 1)
3) Find the vector from the point, P, to the point in the plane, P1. In other words vector = P1-P.
4) Take the absolute magnitude of the dot product of the planes normal vector dotted with the vector from #3. That will be your perpendicular distance. abs( dot( normalVector, P1-P )
To find the perpendicular distance between a point and a plane:
1) Planes are usually defined by a normal vector and a point in space.
2) Ensure the plane''s normal vector is normalized(length fo 1)
3) Find the vector from the point, P, to the point in the plane, P1. In other words vector = P1-P.
4) Take the absolute magnitude of the dot product of the planes normal vector dotted with the vector from #3. That will be your perpendicular distance. abs( dot( normalVector, P1-P )
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement