1001Ferramentas
Calculators

Parallel Lines Distance 2D Calculator

Computes distance between two parallel lines in the plane from coefficients a x plus b y plus c1 and a x plus b y plus c2.

Distance between two parallel lines in 2D

Two lines count as parallel when they share the same normal vector (a, b) and differ only in the constant term. Write them in general form, a·x + b·y + c₁ = 0 and a·x + b·y + c₂ = 0, and the perpendicular distance between them works out to d = |c₂ − c₁| / √(a² + b²). Here's the reason it works: each line sits at signed distance −cᵢ/√(a²+b²) from the origin along the unit normal, so the gap is just the difference of those two offsets. Take y = 2x + 1 and y = 2x + 5, which become 2x − y + 1 = 0 and 2x − y + 5 = 0. That gives d = |5 − 1| / √(2² + 1²) = 4/√5 ≈ 1.789. When the (a, b) coefficients aren't identical but only proportional, normalise both equations first by dividing each through by √(a²+b²).

Applications

CAD uses it to compute offset distances between parallel walls or hatched edges. GIS relies on it to set safety buffers around railway corridors and pipeline easements. In urban planning it drives parking-stall layout per NBR 6492 and lane-width checks; in image processing it supports parallel-edge detection, from banknote strips to barcode bars; and in structural design it confirms clearances between parallel beams.

FAQ

What if the lines are written with different (a, b) pairs? They're parallel only when (a₁, b₁) is a scalar multiple of (a₂, b₂). Divide each equation by its own √(a²+b²) so the normals turn into unit vectors and match each other up to sign, then apply the formula.

And if the lines coincide? Once normalised, c₁ = c₂ means |c₂ − c₁| = 0 and d = 0. The "two" lines are really one and the same.

What if the lines are not parallel? Then they intersect, and the distance is zero at the crossing point while having no single value anywhere else. The formula above won't help; reach for point-to-line distance instead.

Related Tools