How can I tell if a vector intersects a plane?
I know this is more of a maths question but it does relate to 3D graphics:
If I have a 3D vector which goes infinitely in one direction how can I work out if that vector intersects with a plane and at what point on that plane (in 3D coordinates) it collides?
Regards,
Paulcoz.
I think you mean a line, not a vector, because a vector always has finite length.
If v is the direction vector of the line and n is the normal of the plane, there''s only an intersection if v*a != 0.
line equation:
x = A.x + t*v.x
y = A.y + t*v.y
z = A.z + t*v.z
plane equation:
a*x + b*y + c*z + d = 0
Substitute x, y and z in the plane equation with x, y and z of the line equations and calculate t. Then calculate x, y and z in the line equation with t.
GA
If v is the direction vector of the line and n is the normal of the plane, there''s only an intersection if v*a != 0.
line equation:
x = A.x + t*v.x
y = A.y + t*v.y
z = A.z + t*v.z
plane equation:
a*x + b*y + c*z + d = 0
Substitute x, y and z in the plane equation with x, y and z of the line equations and calculate t. Then calculate x, y and z in the line equation with t.
GA
How do you find the intersection between a line and a plane bounded
by 4 vertices at its corners (i.e. not infinite) ?
by 4 vertices at its corners (i.e. not infinite) ?
Ok here is a really simple explanation but youll have to figure out putting it in
BEGIN: CALC
Intermediate value theorem (?):
If F(x) is continuous (no holes, asymptotes, etc.) and if X1
Hope it helps you some, probally not :]
BEGIN: CALC
Intermediate value theorem (?):
If F(x) is continuous (no holes, asymptotes, etc.) and if X1
Hope it helps you some, probally not :]
Ok here is a really simple explanation but youll have to figure out putting it in
BEGIN: CALC
Intermediate value theorem (?):
If F(x) is continuous (no holes, asymptotes, etc.) and if X1
Argh, it purged my message
Hope it helps you some, probally not :]
BEGIN: CALC
Intermediate value theorem (?):
If F(x) is continuous (no holes, asymptotes, etc.) and if X1
Argh, it purged my message
Hope it helps you some, probally not :]
Ok here is a really simple explanation but youll have to figure out putting it in
BEGIN: CALC
Intermediate value theorem (?):
If F(x) is continuous (no holes, asymptotes, etc.) and if
X1 < c < X2
,where X1 and X2 are values for F(x), then a point must exist between X1 and X2 where F(x)==c.
Basically, if the beginning and end of the vector are not both larger/smaller than the respective values (X and Y, whichever you test first) of the plane.
So if the vector is pointing down, then check the beginning and end of it against the Y of the plane.
If the Y value falls in between the two points, then check your x also. If not, then you can just kick it out.
Be sure to check for == so as to deal with the vector being on plane.
I can''t put in less than signs? Whats going on here?
Argh, it purged my message
Hope it helps you some, probally not :]
BEGIN: CALC
Intermediate value theorem (?):
If F(x) is continuous (no holes, asymptotes, etc.) and if
X1 < c < X2
,where X1 and X2 are values for F(x), then a point must exist between X1 and X2 where F(x)==c.
Basically, if the beginning and end of the vector are not both larger/smaller than the respective values (X and Y, whichever you test first) of the plane.
So if the vector is pointing down, then check the beginning and end of it against the Y of the plane.
If the Y value falls in between the two points, then check your x also. If not, then you can just kick it out.
Be sure to check for == so as to deal with the vector being on plane.
I can''t put in less than signs? Whats going on here?
Argh, it purged my message
Hope it helps you some, probally not :]
Let me restate my question with an example:
Given a vector pointing down toward some quad-generated terrain, let''s
say from your camera position which is travelling over it, and given that
you have pre-calculated the normals for all your planes, how would you
find what specific terrain quad (defined by 4 vertices) you happen to
be over at the moment?
Given a vector pointing down toward some quad-generated terrain, let''s
say from your camera position which is travelling over it, and given that
you have pre-calculated the normals for all your planes, how would you
find what specific terrain quad (defined by 4 vertices) you happen to
be over at the moment?
Wayfarer, I do not know any 3D math, but as a general programming / problem solving rule I''d break your problem down like this:
1. Find the point at which the vector intersects the plane (paulcoz''s original problem - but you might be able to take advantage of the fact that you know for sure that an intersection occurs, and even a little about such an intersection due to the fact that your vector will always be pointing ''down'' at the terrain.)
2. Find out which terrain quad contains the intersection point. (this will use the same techniques used in just about any above-view, side-view, or isometric-view 2D game - depending on the nature of you terrain mapping it might be as simple as a few division operations).
Best of luck.
1. Find the point at which the vector intersects the plane (paulcoz''s original problem - but you might be able to take advantage of the fact that you know for sure that an intersection occurs, and even a little about such an intersection due to the fact that your vector will always be pointing ''down'' at the terrain.)
2. Find out which terrain quad contains the intersection point. (this will use the same techniques used in just about any above-view, side-view, or isometric-view 2D game - depending on the nature of you terrain mapping it might be as simple as a few division operations).
Best of luck.
Wayfarer, I do not know any 3D math, but as a general programming / problem solving rule I''d break your problem down like this:
1. Find the point at which the vector intersects the plane (paulcoz''s original problem - but you might be able to take advantage of the fact that you know for sure that an intersection occurs, and even a little about such an intersection due to the fact that your vector will always be pointing ''down'' at the terrain.)
2. Find out which terrain quad contains the intersection point. (this will use the same techniques used in just about any above-view, side-view, or isometric-view 2D game - depending on the nature of you terrain mapping it might be as simple as a few division operations).
Best of luck.
It seems to be thinking I''m an anonymous poster ... I am Xai if you have any further questions
1. Find the point at which the vector intersects the plane (paulcoz''s original problem - but you might be able to take advantage of the fact that you know for sure that an intersection occurs, and even a little about such an intersection due to the fact that your vector will always be pointing ''down'' at the terrain.)
2. Find out which terrain quad contains the intersection point. (this will use the same techniques used in just about any above-view, side-view, or isometric-view 2D game - depending on the nature of you terrain mapping it might be as simple as a few division operations).
Best of luck.
It seems to be thinking I''m an anonymous poster ... I am Xai if you have any further questions
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement