mwg API
    Preparing search index...

    Function buildHeightIndex

    • looks up a cell's height by its integer grid coordinate in O(1) rather than scanning cells on every query

      Parameters

      Returns Map<string, number>

      import { buildHeightIndex, heightAt } from '@datamoc/mwg/3d';

      const heights = buildHeightIndex([
      { x: 0, y: 0 },
      { x: 1, y: 0, height: 2 },
      ]);
      console.log(heightAt(heights, 'square', 1.2, 0.1)); // 2