First, let's take a look at Manhattan,Manhattan is an extremely prosperous BlockThere are many tall buildings and streets. There is no straight path from location a to location B. There must be a detour, and at least it must pass through Location C and take location AC and CB to arrive. Because the streets are quite regular, ACB is like a right angle 3 angular, AB is the oblique side, AC and CB are the straight angle side, according (Stock check) Theorem, or vector theory, we can know that AC and CB can express the length of AB.
In early computer graphics, the screen was composed of pixels, integers, and the coordinate of points was generally integers, because floating point operations were expensive and very slow with errors, if the AB distance is used directly, you must perform a floating point operation. If AC and CB are used, you only need to calculate addition and subtraction, which greatly improves the operation speed, and no error exists regardless of the number of accumulated operations. Therefore, computer graphics uses Manhatton to name this representation.
In our commonly used planar CAD, there will be lattice points, which are the basic unit. After defining the lattice point size, we can use Integers to represent and operate without introducing computational errors, fast and accurate.
Distance between Manhattan and Euclidean: red, blue, and yellow lines respectively indicate that all Manhattan has the same length (12), while the green line indicates that Euclidean distance is 6 × √ 2 ≈ 8.48.
Manhattan Distance Algorithm