Ray-Plane Intersection Calculator

Enter the ray origin, direction, and plane normal & constant to find the intersection point.

How it is calculated

The ray is P(t) = O + t·D, with origin O = (Ox, Oy, Oz) and direction D = (Dx, Dy, Dz). The plane is n·X = d, with normal n = (nx, ny, nz) and offset d. Substituting gives t = (d − n·O) ÷ (n·D), and the hit point is O + t·D, shown to four decimals. A result with t ≥ 0 is reported as a hit in front of the origin; a negative t means the plane is behind the origin. The direction and normal do not need to be unit length, but then t is measured in multiples of D, not in distance, and d is in the scale of n. If n·D is almost zero (below 10⁻¹²) the ray is parallel to the plane: the point and t show a dash and the hit status says "Parallel to the plane, no intersection" or, when the origin is also on the plane, "Ray lies in the plane". All ten fields must be filled in.

Worked example

A ray starts at O = (1, 2, 5) and points along D = (0.5, 0, −1). The plane is z = 1, so n = (0, 0, 1) and d = 1. First, n·D = 0×0.5 + 0×0 + 1×(−1) = −1 and n·O = 5. Then t = (1 − 5) ÷ (−1) = 4. The tool shows t as 4.0000. The point is O + 4·D = (1 + 2, 2 + 0, 5 − 4) = (3.0000, 2.0000, 1.0000). Because t is positive, the plane lies in front of the origin and the result is a hit.

Try this example →

Common mistakes

  • Entering a point on the plane as d. The offset d is the dot product n·X for a point X on the plane, so for the plane z = 1 with n = (0, 0, 1) it is 1, but for n = (0, 0, 2) the same plane needs d = 2.
  • Reading t as a distance when the direction is not normalized. With D = (2, 0, −2), t is in units of that vector, so the hit above comes at t = 2, not at 2 length units.
  • Ignoring a negative t. The infinite line meets the plane, but behind the origin, so a camera or laser pointing that way will never reach it.
  • Reading the dash as an error. When D is perpendicular to the normal (n·D = 0) there is no single hit point, so the point and t show a dash and the hit status tells the two cases apart: parallel with no intersection, or the ray lying in the plane.
  • Mixing coordinate conventions, such as using a y-up normal with a z-up scene. The normal and the ray must use the same axes.

Sources

About this calculator

In 3D graphics and geometry, a ray is expressed parametrically as O + t·D, an origin point O extended along a direction D by a scalar t, while a plane is defined by the implicit equation n·X = d, where n is the plane's normal vector and d is a constant offset. Substituting the ray into the plane equation and solving gives t = (d − n·O) / (n·D); plugging that t back into O + t·D yields the exact hit point.

This is the core computation behind ray tracing renderers, CAD collision and clipping tests, and physics-engine raycasts. When n·D is zero the ray is parallel to the plane and never intersects it (or lies within it), and a negative t means the intersection lies behind the ray's origin rather than in front of it. This calculator flags the negative-t case explicitly; for a parallel ray (n·D = 0) it says so, telling a ray that lies in the plane from one that never meets it.

Was this helpful?

You can pick up to 3 reactions.

Comments

  • Be the first to comment.

Popular calculators

All Calculators