MCPcopy Create free account
hub / github.com/microsoft/SandDance / getGridCell

Function getGridCell

docs/app/js/sanddance-app.js:102419–102427  ·  view source on GitHub ↗
(p, gridResolution, gridOffset, out)

Source from the content-addressed store, hash-verified

102417 ];
102418}
102419function getGridCell(p, gridResolution, gridOffset, out) {
102420 const left = Math.floor((p[0] - gridOffset[0]) / gridResolution) * gridResolution + gridOffset[0];
102421 const bottom = Math.floor((p[1] - gridOffset[1]) / gridResolution) * gridResolution + gridOffset[1];
102422 out[0] = left;
102423 out[1] = bottom;
102424 out[2] = left + gridResolution;
102425 out[3] = bottom + gridResolution;
102426 return out;
102427}
102428function moveToNeighborCell(cell, gridResolution, edge) {
102429 if (edge & 8) {
102430 cell[1] += gridResolution;

Callers 2

cutPolylineByGridFunction · 0.70
cutPolygonByGridFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected