Pythagorean Box Surface Route Calculator
Enter measured box dimensions and two positions on its lower and upper faces. Unfold the walls to use the Pythagorean theorem, compare valid paths, and see where the chosen path crosses each edge.
Find the shortest path along a box’s surface
Unfold the faces to compare valid straight routes between opposite faces.
Box dimensions and endpoints
Use the same unit throughout. Both X, Y positions use the front-left corner as (0, 0). The lower face is at Z = 0 and the upper face is at the box height.
2 unfoldings share the shortest distance.
Shortest distance along the faces
- Surface length
- 40
- Exact 40
- Straight distance through the box
- 31.622777
- For comparison
- Shortest side sequence
- Back → Left → Front
- 3 side faces
- Valid unfoldings
- 16 / 28
- Both end seams crossed
Compare unfolded candidates
Lower → Back → Left → Front → Upper
Valid route · exact length 40
| Crossed edge | Exact X, Y, Z |
|---|---|
| Lower → Back | 21/4, 12, 0 |
| Back → Left | 0, 12, 7 |
| Left → Front | 0, 0, 23 |
| Front → Upper | 21/4, 0, 30 |
View all candidate unfoldings
| Sides | Length | Status |
|---|---|---|
| 1 · Back → Left → Front | 40 | Shortest |
| 2 · Back → Right → Front | 40 | Shortest |
| 3 · Right → Front | √(1658) | Valid |
| 4 · Back → Left | √(1658) | Valid |
| 5 · Back → Right | √(1658) | Valid |
| 6 · Left → Front | √(1658) | Valid |
| 7 · Front | 42 | Valid |
| 8 · Back | 42 | Valid |
| 9 · Right | √(1864) | Valid |
| 10 · Left | √(1864) | Valid |
| 11 · Front → Right | √(2258) | Valid |
| 12 · Front → Left | √(2258) | Valid |
| 13 · Right → Back | √(2258) | Valid |
| 14 · Left → Back | √(2258) | Valid |
| 15 · Front → Right → Back | √(3280) | Valid |
| 16 · Front → Left → Back | √(3280) | Valid |
| 17 · Right → Back → Left → Front | — | Rejected |
| 18 · Back → Left → Front → Right | — | Rejected |
| 19 · Back → Right → Front → Left | — | Rejected |
| 20 · Left → Back → Right → Front | — | Rejected |
| 21 · Right → Back → Left | — | Rejected |
| 22 · Right → Front → Left | — | Rejected |
| 23 · Left → Front → Right | — | Rejected |
| 24 · Left → Back → Right | — | Rejected |
| 25 · Front → Right → Back → Left | — | Rejected |
| 26 · Front → Left → Back → Right | — | Rejected |
| 27 · Right → Front → Left → Back | — | Rejected |
| 28 · Left → Front → Right → Back | — | Rejected |
Export the route audit
Save all candidates, exact distances and seam positions.
View CSV text
How to use this calculator
- Enter width, depth, and height using one unit throughout.
- Enter X, Y at the lower and upper faces. Both coordinates start at the same front-left corner as viewed from above.
- Review the shortest length and select an unfolding. Open the candidate table to see the side sequence for each route number.
- Compare exact seam positions, or download the CSV to audit the candidates.
The Formula
The mathematical logic powering this calculation is:
Enter coordinates on opposite faces at Z = 0 and Z = H. For a candidate route, unfold its side faces into a strip of height H. Attach the lower face to the bottom edge of the first wall and the upper face to the top edge of the last wall.
Let (u₀, v₀) and (u₁, v₁) be the endpoints in the unfolded plane. The Pythagorean length squared is (u₁ − u₀)² + (v₁ − v₀)². At a horizontal seam with height t, the line crosses at u₀ + (u₁ − u₀)(t − v₀)/(v₁ − v₀). The values at t = 0 and t = H must be on the edge segments of the first and last wall, including the endpoints. The side strip is a rectangle, so these crossings keep the line inside it. Lower and upper faces are rectangles too. Each remaining seam has a fixed horizontal coordinate and its height follows from the same line.
There is always a shortest route that visits each face at most once. If a path leaves and returns to one face, the straight path between those two points on that face is no longer. The side walls form a cycle, so the worksheet checks 28 distinct wall sequences that use each face at most once. The smallest exact squared length among valid unfoldings gives the surface distance. Equal lengths count tied unfoldings. At an edge or vertex, multiple unfoldings can represent the same physical path.
Use any consistent unit and decimal dimensions from 0.000000000001 through 1,000,000. Each point can lie anywhere on its face including the boundary. Ranking and edge tests use exact fractional arithmetic. The model assumes a closed rectangular box with unobstructed faces.Worked Example
If you input:
- Width × depth × height: 12 × 12 × 30
- Lower point X, Y: 6, 11
- Upper point X, Y: 6, 1
Result:
The shortest path is 40 units. Back → Left → Front and Back → Right → Front are tied. In either unfolded layout, the endpoints are 24 units apart horizontally and 32 vertically.
Frequently Asked Questions
Why are some unfoldings rejected?
A straight line can fall outside the faces that were unfolded. The worksheet checks both entry and exit seams to confirm that the straight line stays on the selected faces.
Can an endpoint be on an edge or a corner?
Yes. The lower and upper points can use any coordinate on the closed face. Several unfoldings can trace the same path when a candidate starts or ends at a boundary.
How does this differ from the straight distance through the box?
The through-box distance is the three-dimensional line between the points. The surface distance follows the outside of the box and is at least as long. They can coincide when the straight line lies on a single wall.
Similar Calculators
Pythagorean Theorem Calculator
Solve for the missing side of a right triangle using the Pythagorean theorem.
Triangular Prism Surface Area & Volume Calculator
Calculate surface area and volume for a right triangular prism. Compare depths, select rectangular faces and end caps, and solve an exact feasible depth interval.
Quadrilateral Area Calculator & Diagonal Reconstruction
Find quadrilateral area from four sides and one diagonal. Compare reconstructed corner placements and identify convex, concave and crossed boundaries.
