Manhattan Distance Algorithm

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.