UNPKG

@rickosborne/hexgrid

Version:

Rick Osborne's collection of hexagonal grid-related code.

23 lines (22 loc) 808 B
var __defProp = Object.defineProperty; var __name = (target, value) => __defProp(target, "name", { value, configurable: true }); import { cubeAdd } from "./cube-add.mjs"; import { cubeDistance } from "./cube-distance.mjs"; import { cubeLerp } from "./cube-lerp.mjs"; import { cubeRound } from "./cube-round.mjs"; import { CUBE_EPSILON } from "./cube.mjs"; const cubeLineDraw = /* @__PURE__ */ __name((a, b) => { const distance = cubeDistance(a, b); const step = 1 / Math.max(1, distance); const points = []; const begin = cubeAdd(a, CUBE_EPSILON); const end = cubeAdd(b, CUBE_EPSILON); for (let i = 0; i <= distance; i++) { points.push(cubeRound(cubeLerp(begin, end, step * i))); } return points; }, "cubeLineDraw"); export { cubeLineDraw }; //# sourceMappingURL=cube-line-draw.mjs.map