You made a mistake in the formulae. The way you’re looking at it, you should write:
(a + sqrt(b^2 + c^2))
(b + sqrt(a^2 + c^2))
(c + sqrt(a^2 + b^2)).
And even then, you wouldn’t get the shortest distance. To give an example,
suppose the cube is of 1x1x1 units with sides along the x, y and z axes. In order for the ant to get from (0,0,0) to (1,1,1), it can go from
(0,0,0) -> (0,1,1) -> (1,1,1)
or
(0,0,0) -> (0, 0.5, 0.5) -> (1,1,1)
The second path is the shorter one obviously.
0
solved Ant in a Cuboid find shortest path: length, width and height of a cuboid are given. Output should display the shortest distance in floating point [closed]