Incidence Problems: Points on Lines, Segments, Planes, Triangles and Parallelograms

An incidence problem asks whether a point lies on a given object: on a line (the parameter t exists), on a segment (0 ≤ t ≤ 1), in a plane (the coordinates satisfy the equation), inside a triangle (P = A + u·AB + v·AC with u, v ≥ 0 and u + v ≤ 1) or inside a parallelogram (0 ≤ u, v ≤ 1). In brief: for A(1, 1) and B(5, 3), the point P(3, 2) is the midpoint (t = 0.5), so it lies on the segment, while Q(7, 4) has t = 1.5, so it lies on the line AB but outside the segment.

All tests below reduce to solving for coefficients in a vector equation and reading conditions on those coefficients. This guide shows the method for lines, segments, rays, planes, triangles and parallelograms in the plane and in space, with worked examples and a summary table.

How do you test a point on a line, segment or ray?

The point P is on the line through A and B when P = A + t · AB for some number t, where AB = B − A. All coordinate equations must give the same t. Then the position of t decides the type: 0 ≤ t ≤ 1 means P is on the segment AB, t ≥ 0 means P is on the ray from A through B, t = 0 or 1 gives the endpoints, and t = 1/2 the midpoint.

Example 1: a segment test in the plane

A(1, 1), B(5, 3), AB = (4, 2). P(3, 2): (2, 1) = t(4, 2) gives t = 1/2 in both coordinates, so P is the midpoint. Q(7, 4): (6, 3) = t(4, 2) gives t = 3/2, so Q is on the line but beyond B. R(3, 3): (2, 2) = t(4, 2) gives 1/2 and 1, inconsistent, so R is not on the line.

ABPQR

Example 2: a test in space

A(1, 2, 3), B(4, 0, 5), AB = (3, −2, 2). P(2.5, 1, 4): (1.5, −1, 1) = (1/2)(3, −2, 2), so t = 1/2: the midpoint. S(7, −2, 7): t = 2 in all three coordinates, so S is on the line beyond B.

Example 3: dividing a segment

A point P on AB with AP : PB = 2 : 3 has t = 2/5, so P = A + (2/5)AB. For A(0, 0), B(10, 5): P = (4, 2).

How do you test a point on a plane?

Substitute the point into Ax + By + Cz + D = 0. Zero means the point lies in the plane. The sign tells on which side it lies.

Example 4: a plane test

Plane 2x − y + 4z − 12 = 0. P(1, 2, 3): 2 − 2 + 12 − 12 = 0, so P is in the plane. Q(0, 0, 0): −12 < 0 and R(5, 0, 2): 10 + 8 − 12 = 6 > 0; Q and R lie on opposite sides.

How do you test a point in a triangle?

Write P = A + u · AB + v · AC. The numbers u and v are the barycentric-type coordinates. P lies inside the triangle ABC (or on its boundary) if and only if u ≥ 0, v ≥ 0 and u + v ≤ 1. The edge AB corresponds to v = 0, the edge AC to u = 0 and the edge BC to u + v = 1. In space, P must first lie in the plane of the triangle; if the system for u and v has no solution, it does not.

Example 5: points relative to a triangle

A(0, 0), B(4, 0), C(0, 4): AB = (4, 0), AC = (0, 4), so u = x/4 and v = y/4.

PQRS

Example 6: a triangle in space

A(1, 0, 0), B(0, 1, 0), C(0, 0, 1) span the plane x + y + z = 1. Then A + u AB + v AC = (1 − u − v, u, v). The centroid (1/3, 1/3, 1/3) has u = v = 1/3: inside. The point (1, 1, −1) lies in the plane (1 + 1 − 1 = 1), and u = 1, v = −1 < 0, so it is outside the triangle. The point (1, 1, 0) is not in the plane (sum 2), so it is not in the triangle at all.

Example 7: using areas

The same coordinates equal ratios of areas: for the centroid, each of the three subtriangles has the area one third of the triangle ABC.

How do you test a point in a parallelogram?

For the parallelogram ABCD with sides AB and AD, write P = A + u · AB + v · AD. The point is inside or on the boundary exactly when 0 ≤ u ≤ 1 and 0 ≤ v ≤ 1. The vertices correspond to (u, v) = (0, 0), (1, 0), (1, 1), (0, 1), and the center to (1/2, 1/2). A rectangle or a rhombus is tested in the same way.

Example 8: a parallelogram test

A(0, 0), B(4, 1), D(1, 3), so C = B + D − A = (5, 4). For P(2.5, 2): 4u + v = 2.5, u + 3v = 2. From the first, v = 2.5 − 4u; then u + 7.5 − 12u = 2, so u = 1/2, v = 1/2: the center. For Q(4, 3): 4u + v = 4, u + 3v = 3 gives u = 9/11, v = 8/11: inside. For R(6, 3): 4u + v = 6, u + 3v = 3 gives u = 15/11 > 1: outside.

ABCDPQR

When does a segment cross a plane?

Evaluate f(X) = Ax + By + Cz + D at both ends. If f(A) and f(B) have opposite signs, the segment crosses the plane. The crossing point corresponds to t = f(A)/(f(A) − f(B)).

Example 9: a crossing

A(1, 1, 1), B(3, 3, 5), plane x + y + z − 6 = 0. f(A) = −3, f(B) = 5. Opposite signs, and t = −3/(−3 − 5) = 3/8. Crossing point: A + (3/8)(2, 2, 4) = (1.75, 1.75, 2.5), and 1.75 + 1.75 + 2.5 = 6 ✓.

Table of incidence conditions

Conditions for a point to lie on or in an object
Object Representation of P Condition
line ABA + t · ABt exists (same for all coordinates)
segment ABA + t · AB0 ≤ t ≤ 1
ray ABA + t · ABt ≥ 0
planeAx + By + Cz + Dequals 0
triangle ABCA + u · AB + v · ACu, v ≥ 0, u + v ≤ 1
parallelogram ABCDA + u · AB + v · AD0 ≤ u ≤ 1, 0 ≤ v ≤ 1

Where does the barycentric idea come from?

The coordinates u, v and 1 − u − v are barycentric coordinates, introduced by August Ferdinand Möbius in his 1827 book on the barycentric calculus. They represent a point as a weighted average (center of mass) of the vertices. They remain central in computer graphics for rasterizing triangles.

Which mistakes are common?

Checking only one coordinate

A point is on a line only if all coordinate equations give the same value of t, as for R in Example 1.

Mixing up line, ray and segment

The line has all t; the segment only 0 ≤ t ≤ 1. Always state the range.

Forgetting the plane of a triangle in space

A point can have coordinates u, v in the allowed range for two of the three equations and still be off the plane. Check coplanarity first.

Wrong sides of the parallelogram

Use two sides from the same vertex (AB and AD), not opposite sides or the diagonal.