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
Distance Between Coordinates
Calculate the great-circle distance between two GPS points using the Haversine formula. Result in km, miles and nautical miles, with bearing. Everything in your browser.
Home Magic Portal Walk
Computes minutes on foot between home and a magic portal at 80 m/min.
3D Points Distance
Computes the Euclidean distance between two points in 3D space from their coordinates.
Belt Center Distance Calculator
Compute center distance between two pulleys for a given belt length using Liter's approximation.
Earth to Sun Distance in AU by Date
Pick a calendar date and get the Sun distance in astronomical units and km from orbital eccentricity 0.01671: 0.9833 AU in early January, 1.0167 AU in July.
Romance Language Lexical Similarity Calculator
Estimates approximate lexical similarity between two Romance languages from known tables for Portuguese, Spanish, Italian, French and Romanian.
The results provided by this tool are for general informational and educational purposes only and do not constitute professional, financial, medical, legal, tax or accounting advice. Always confirm important decisions with a qualified professional and official sources.