mwg API
    Preparing search index...

    Function euclidean

    • Euclidean ruler distance between two cells.

      The counterpart to roguelike's chebyshevDistance, which charges a diagonal the same as a step: use this one when the true straight-line distance matters (blast falloff, census radius) and that one for roguelike range and movement.

      Parameters

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

      Returns number

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

      euclidean({ x: 0, y: 0 }, { x: 3, y: 4 }); // 5