Skip to main content
gamedev.net
🔒 Locked

Line intersection with Parallel Plane

Started by dinaharchery 9 replies 1.5k views
Original Post
dinaharchery
dinaharchery
I have found some information searching around on the internet for line-plane intersections, but have a slight variation that I hope someone has an answer to. I have a 3D Plane, 'P' defined by a series of points 'P' and a 3D Line, 'L' defined by two points P0 and P1. I know that one of the points in the Line L falls inside the 3D Plane 'P'. I would like to know if it is possible to determine the exact point where the Line L intersects with the Plane P. A few caveats: I am making the assumption that the Plane P is convex and the Line lies in the same plane where the Plane P lies (except as I said, one of the two points of the line is outside the Plane and one is inside of the Plane). Any help would be great, perhaps there is a link to a geometry page with this info? Thanks :)
johnstanp
johnstanp
A plane can be defined by any two non colinear vectors. Let u1( u1x, u1y, u1z ) and u2( u1x, u2y, u2z ) be two non colinear vectors. A point P( x, y, z ), in the plane is a linear combination of these two vector, that is to say, there exist two reals s, t such that( such as? ):

x = x10 + s * u1x + t * u2x
y = y10 + s * u1y + t * u2y
z = z10 + s * u1z + t * u2z

( x10, y10, z10 ) being a point located in the plane.

The "same" can be done with a line. Let u3( u3x, u3y, u3z ) be a direction vector of the line and ( x20, y20, z30 ) a point belonging to the line.
For any point on the line, there exist a real r such that( such as? ):

x = x20 + r * u3x
y = y20 + r * u3y
z = z20 + r * u3z

The intersection point of the plane and the line, verifies both systems of equations, that it to say, if its coordinates are ( x*, y*, z* ), we have:

x* = x10 + s * u1x + t * u2x (1)
y* = y10 + s * u1y + t * u2y (2)
z* = z10 + s * u1z + t * u2z (3)

and

x* = x20 + r * u3x (4)
y* = y20 + r * u3y (5)
z* = z20 + r * u3z (6)

(1)==(4) and (2)==(5) and (3)==(6), so:

x10 + s * u1x + t * u2x = x20 + r * u3x (7)
y10 + s * u1y + t * u2y = y20 + r * u3y (8)
z10 + s * u1z + t * u2z = z20 + r * u3z (9)

(7), (8) and (9) is a system of equations that can be solved( three equations and three unknowns ). In matrix form, we have:

|u1x u2x -u3x| |s| |x20 - x10|
|u1y u2y -u3y| |t| = |y20 - y10|
|u1z u2z -u3z| |r| |z20 - z10|

otherwise: A * X = B with A being the 3x3 matrix, X the vector containing the unknows and B the constants of the right side.

=>X = inverse( A ) * B

Replacing the value of r found in (4),(5) and (6) provides the coordinates of the point of intersection...
dinaharchery
dinaharchery
Thank you fcoelho and johnstanp for the replys.

I was mainly concerned about the proper calculation of the point of intersection between the line and the plane because the line will run perpendicular to the normal vector of the plane. Will this be a problem?

Thanks again (especially johnstanp, that was a very informative explaination).
Vorpy
Vorpy
If the line is perpendicular to the normal of the plane, then it is parallel to the plane. In this case the line interesects the plane either nowhere or everywhere on the line.
dinaharchery
dinaharchery
Sorry,

I should have said segment instead of line since I am dealing with a line between two separate points in 3D space. Does this make any difference?

fcoelho
fcoelho
Quote:
Original post by dinaharchery
... because the line will run perpendicular to the normal vector of the plane. Will this be a problem?


As Vorpy said, if this is true, either your line never crosses the plane or it is inside the plane. For the latter, there are infinite points that answers your question. are you sure of what you wrote?

Quote:

I should have said segment instead of line since I am dealing with a line between two separate points in 3D space. Does this make any difference?


In the article I showed up before, you will find that, after calculating the variable u, to see if the point of intersection is in the line segment, you just have to check if it is between 0 and 1
Vorpy
Vorpy
Are you talking about a plane or are you really talking about a polygon? A plane extends infinitely in the directions perpendicular to the normal. If you're talking about a polygon, stop calling it a plane.
dinaharchery
dinaharchery
Thank you for the information.

I want to learn more about computational geometry. Do you have any suggestions for a beginner book on this subject?

Thanks again.
johnstanp
johnstanp
Quote:
Original post by dinaharchery
Thank you fcoelho and johnstanp for the replys.

I was mainly concerned about the proper calculation of the point of intersection between the line and the plane because the line will run perpendicular to the normal vector of the plane. Will this be a problem?

Thanks again (especially johnstanp, that was a very informative explaination).


My pleasure...
If the line is perpendicular to the plane's normal, then there's an infinite number of intersection points: they all lie on( in? ) the line, or if you want, the line itself is the set of intersection points.
That will translate in a determinant equal to zero: the matrix derived from the equations won't be inversible because two of its columns or rows will be colinear.

dinaharchery
dinaharchery
Thanks for all the replys.

Vorpy, I am sorry I should have stated polygon not plane - another reason I need to find a good book on computational geometry.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.