mwg API
    Preparing search index...

    Function manhattan

    • Manhattan ruler distance between two cells: the orthogonal-step count, no diagonals.

      The counterpart to euclidean and chebyshev for four-way movement and range, where every step is axis-aligned.

      Parameters

      • a: { x: number; y: number }
      • b: { x: number; y: number }

      Returns number

      import { manhattan } from '@datamoc/mwg/core';

      manhattan({ x: 0, y: 0 }, { x: 3, y: 4 }); // 7