Collision Detection between Point and a Plane
Hi guys, How do I calcule a collision detection between a point and a plane (a Quad with 4 vertexes)?
Its quite simple.
---edit----
hehe sorry, i didnt notice you already put (a quad with 4 vertexes)
so ignore some of the sarcasim
---edit----
your point is say (0, 0) at the origin. its at an infinante number of planes. Most obvious being X = 0 (plane perpendicular to x) Y = 0 ( plane perpindicular to the y)
Now i think you want to know how to detect if its in a restricted plane, or a 'polygon'. To make it more simple you will want to restrict the 'polygon' into a quad (or triangles). Then just write a long if statement. If you find that hard get a piece of paper draw a square, give it points, and shade it; then figure out what the points cordinates have to be less than or greater than.
There might be a more simple way.
check out www.gametutorials.com
[edited by - Prod on September 18, 2002 11:00:48 PM]
---edit----
hehe sorry, i didnt notice you already put (a quad with 4 vertexes)


---edit----
your point is say (0, 0) at the origin. its at an infinante number of planes. Most obvious being X = 0 (plane perpendicular to x) Y = 0 ( plane perpindicular to the y)
Now i think you want to know how to detect if its in a restricted plane, or a 'polygon'. To make it more simple you will want to restrict the 'polygon' into a quad (or triangles). Then just write a long if statement. If you find that hard get a piece of paper draw a square, give it points, and shade it; then figure out what the points cordinates have to be less than or greater than.
There might be a more simple way.
check out www.gametutorials.com
[edited by - Prod on September 18, 2002 11:00:48 PM]
#1 calculate the equation for the plane.
#2 plug in the x,y,z coordinates of the point and see if they work in the equation.
if they do, its in the plane, if not the its not.
nitzan
-------------------------
www.geocities.com/nitzanw
www.scorchedearth3d.net
-------------------------
#2 plug in the x,y,z coordinates of the point and see if they work in the equation.
if they do, its in the plane, if not the its not.
nitzan
-------------------------
www.geocities.com/nitzanw
www.scorchedearth3d.net
-------------------------
September 19, 2002 12:58 PM
Just a bit more detail...
-You have Ax + By + Cy -D = 0 as the equation of a plane.
-Since you have 4 points in a quad there are enough to define the equation of a plane.
-Once A, B, C and D coefficients are solved, you can plug in x, y, z to see if they satisfy equation, as mentionned by an earlier poster.
-If this is a realtime game or physics simulation, I assume the x0, y0, z0, point will have some kind of movement. If it is moving, be sure to calculate the x1, y1, z1 positions after the time slice. That is x1 = x0 + Vx * (t1 - t0), then calcucate y1 and z1 similarly.
-If equation gives (+) at t0 and (+) at t1, then you know the point is still on the same side of the plane (both positive). If the equation yields different signs at t0 and t1 (going from positive to negative, or vice-versa) then you know the plane boundary has been breached, in which case your function should return a ''1'' or ''true'' or do whatever it does.
-You have Ax + By + Cy -D = 0 as the equation of a plane.
-Since you have 4 points in a quad there are enough to define the equation of a plane.
-Once A, B, C and D coefficients are solved, you can plug in x, y, z to see if they satisfy equation, as mentionned by an earlier poster.
-If this is a realtime game or physics simulation, I assume the x0, y0, z0, point will have some kind of movement. If it is moving, be sure to calculate the x1, y1, z1 positions after the time slice. That is x1 = x0 + Vx * (t1 - t0), then calcucate y1 and z1 similarly.
-If equation gives (+) at t0 and (+) at t1, then you know the point is still on the same side of the plane (both positive). If the equation yields different signs at t0 and t1 (going from positive to negative, or vice-versa) then you know the plane boundary has been breached, in which case your function should return a ''1'' or ''true'' or do whatever it does.
Check on : http://www.gametutorials.com/
I use his method for my 3D engine and it''s work well.
See in for "Intersection between a line and a triangle"
In his examples, he uses triangles but you can use, like me, for quads or more ...
// Just a try
for (int i = 0; i < 2; i +)
printf("Just a check for include source code\n");
========================
Leyder Dylan
http://ibelgique.ifrance.com/Slug-Production/
I use his method for my 3D engine and it''s work well.
See in for "Intersection between a line and a triangle"
In his examples, he uses triangles but you can use, like me, for quads or more ...
// Just a try
for (int i = 0; i < 2; i +)
printf("Just a check for include source code\n");
========================
Leyder Dylan
http://ibelgique.ifrance.com/Slug-Production/
========================Leyder Dylan (dylan.leyder@slug-production.be.tf http://users.skynet.be/fa550206/Slug-Production/Index.htm/
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement