mwg API
    Preparing search index...

    Function distance

    • Measures a to b with the named ruler, so a rule authored as data (a table row, a authored profile) can pick its geometry without importing each ruler by name.

      Parameters

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

      Returns number

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

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