Ray to Plane intersection

Sometimes you may want to find the intersection point between a ray and a plane. Finding the point of intersection is really easy if you approach it mathematically. We’ve got the formulas for any point on the ray and the plane:

Ray: P = P0 + tV
Plane: 0 = P dot N + d

 The formulas above are true if P represents the point on the ray or plane, P0 represents the ray’s origin, V represents the ray’s direction, N represents the plane’s normal and d is the plane’s distance. The variable t would represent the distance from ray origin to any point on the ray.

If we want to find the intersection P between the ray and the plane we’ll need to integrate the two formulas, we do this by substituting P:

0 = (P0 + tV) dot N + d

We can now simplify this to:

0 = P0 dot N + tV dot N + d

Shift tV dot N to the other side:

tV dot N = 0 – (P0 dot N + d)

Extract t:

t = -(P0 dot N + d) / (V dot N)

We have now found t which represents the distance from the ray’s origin to the point on the ray. This result might be usefull for other things but you can also use it to find the intersection between the ray and the plane by just multiplying it by the ray’s direction and adding that to the ray’s origin.

One Response to Ray to Plane intersection

©2017 Echo Gaming Entries (RSS) and Comments (RSS)  Raindrops Theme