Calculate the distance between two points
The function \(Taxicap\) computes the distance between two points in the coordinate system as the sum of the absolute differences of their individual coordinates, which are connected only by vertical and horizontal vectors.
The cabicap distance (also known as Manhattan distance) takes its name from the checkerboard-like layout of the building blocks and the Manhattan grid, which force a taxi driver to overcome the distance between two addresses by juxtaposing "vertical" and "horizontal" paths.
A taxi driver planning his route through such a system always travels the same distance on the way to his destination, no matter which path he chooses, as long as he only uses paths that bring him closer to his destination.
Taxicap (x1, y1, x2, y2)
Taxicap (Point(x, y), Point(x, y))
The illustration shows examples of the Manhattan distance between the two black dots. The red, blue and yellow lines are the same length (12 units)