How this calculation works
Count integer-grid points on a segment without enumerating all intervening coordinates.
Count=gcd(|Δx|,|Δy|)+1A worked example
From (0,0) to (6,4), gcd(6,4)=2, so there are three points.
Good to know
A zero-length segment has one lattice point.
Reference: OpenStax Algebra and Trigonometry, Trigonometric Applications (opens in a new tab) ↗
Read the result
Count integer-grid points on a segment without enumerating all intervening coordinates.
The primary result is labeled “Points including endpoints”. Keep the input definitions in view when comparing this result with another method.
Try a related calculation
A zero-length segment has one lattice point.
For a related exercise, try the circle calculator.
A few questions, answered
How can I check the default inputs by hand?
From (0,0) to (6,4), gcd(6,4)=2, so there are three points.
Which rule does this calculator apply?
Count=gcd(|Δx|,|Δy|)+1