Lite / Building Machines That Respond / Week 28
Where is that hole? Coordinates and Pythagoras
A drawing says one bolt hole is at (10, 10) mm and another at (40, 50) mm. Your ruler can't measure diagonally across the gap. How far apart are they?
Why should I care?
Every engineering drawing, CAD sketch and robot path is written in coordinates. Machinists drill holes from coordinate tables, and robots move their hands to coordinates. The moment two features are not lined up, the distance between them is a diagonal, and Pythagoras is how engineers get it right first time.
- Locate features on a part with (x, y) coordinates measured from a stated origin.
- Use Pythagoras' theorem to find the straight-line distance between two features.
- Find the angle of a line between two points from its across and up distances.
Predict
Hole A is at (0, 0) mm and hole B is at (30, 40) mm. How far apart are their centres?
- 70 mm (30 + 40)
- 50 mm
- 35 mm (the average)
Guess first, then reveal
50 mm. The 30 mm across and 40 mm up are the two short sides of a right-angled triangle; the gap between the holes is the long side: √(30² + 40²) = √2500 = 50 mm. Adding the sides gives the distance a robot would travel along the grid lines, not the straight line.
Discover
Choose 'Measure a part'. Hole A is fixed at (10, 10) mm. Move hole B, work out the distance on paper with Pythagoras, then press check. Find two positions of B where the distance is a whole number of millimetres.
What the interactive shows (text version)
The geometry explorer shows a 60 by 40 millimetre plate on a 10 millimetre grid. Hole A is fixed at (10, 10). You choose hole B's coordinates with two sliders. Dashed lines show the across distance Δx and the up distance Δy; a solid line joins the holes. After you press check, the distance √(Δx² + Δy²) and the angle of the line are given in words.
Understand
Coordinates need an origin
A coordinate pair (x, y) means 'go x across, then y up' from a chosen origin, usually a corner or the centre of a part. Engineers always state the origin and the unit (mm on drawings), because (10, 10) means nothing without them. Moving the origin changes every coordinate, but never the distance between two features.
Diagonals are hypotenuses
Subtract coordinates to get the across and up distances, Δx and Δy. They form the two short sides of a right-angled triangle, and the straight-line distance is the hypotenuse: d = √(Δx² + Δy²). Check the answer is longer than both Δx and Δy but shorter than their sum. If not, something went wrong.
Angles from the same triangle
The same triangle tells you the direction of the line. The angle above the x-axis has tan θ = Δy ÷ Δx, so θ = tan⁻¹(Δy ÷ Δx). You will meet tan properly next week; for now, notice that a line rising 30 mm over 30 mm across is at 45°, whatever its length.
Explain it another way
Intuitive
Walking across a rectangular field corner to corner is shorter than going round two sides. Pythagoras tells you exactly how much shorter.
Technical
For points (x₁, y₁) and (x₂, y₂), the Euclidean distance is d = √((x₂ − x₁)² + (y₂ − y₁)²) and the direction is θ = atan2(y₂ − y₁, x₂ − x₁). In 3D add (z₂ − z₁)² under the root.
Mathematical
Holes at (10, 10) and (13, 14) mm: Δx = 3, Δy = 4, d = √(9 + 16) = 5 mm. A 60 × 40 mm plate's diagonal: √(3600 + 1600) = √5200 ≈ 72.1 mm.
Applied
Bolt circles on motor mounts, the spacing of wheels on a chassis and the travel of a 3D printer's nozzle are all specified as coordinates, then checked with distances like this.
Derivation: Why the distance is √(Δx² + Δy²)
Write the across distance as Δx = x₂ − x₁ and the up distance as Δy = y₂ − y₁. These are measured along the axes, so they meet at a right angle.
The straight line from A to B closes the triangle. It is the hypotenuse: the side opposite the right angle.
Pythagoras' theorem says the square on the hypotenuse equals the sum of the squares on the other two sides: d² = Δx² + Δy².
Take the square root: d = √(Δx² + Δy²). Squaring means a negative Δx or Δy gives the same distance, so it doesn't matter which point you call A.
Worked example 1
Four bolts sit at the corners of a 40 mm square. How far apart are two diagonally opposite bolts?
Δx = 40 mm, Δy = 40 mm. d = √(40² + 40²) = √3200 ≈ 56.6 mm. (For any square, the diagonal is the side × √2.)
Worked example 2
A robot's gripper is at (120, 80) mm and the part is at (60, 160) mm. How far must the gripper move in a straight line?
Δx = 60 − 120 = −60 mm, Δy = 160 − 80 = 80 mm. d = √(3600 + 6400) = √10000 = 100 mm. The minus sign only tells you it moves left; squaring removes it.
Common mix-ups
The distance between two points is Δx + Δy.
✓ That is the distance along the grid lines. The straight-line distance is √(Δx² + Δy²), which is always shorter unless one of them is zero.Negative coordinates give negative distances.
✓ Distances are never negative: squaring Δx and Δy removes the sign.
Practice
Practice, not a test. Answers are checked on our server; a wrong answer gets a hint and another try. Nothing is saved.
Apply it
Sketch a 60 × 40 mm mounting plate for a small motor with four holes. Give every hole a coordinate from one corner, then calculate the distance between each pair of diagonal holes. Check one with the geometry explorer.
Reflect
Why do engineering drawings give coordinates from one origin instead of measuring each hole from the previous one?
Write your answer on paper or in your own notes. Lite never stores what you write.