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

Function zOrder

docs/tests/v2/es6/js/sanddance.js:69746–69762  ·  view source on GitHub ↗
(x, y, minX, minY, invSize)

Source from the content-addressed store, hash-verified

69744
69745// z-order of a point given coords and inverse of the longer side of data bbox
69746function zOrder(x, y, minX, minY, invSize) {
69747 // coords are transformed into non-negative 15-bit integer range
69748 x = 32767 * (x - minX) * invSize;
69749 y = 32767 * (y - minY) * invSize;
69750
69751 x = (x | (x << 8)) & 0x00FF00FF;
69752 x = (x | (x << 4)) & 0x0F0F0F0F;
69753 x = (x | (x << 2)) & 0x33333333;
69754 x = (x | (x << 1)) & 0x55555555;
69755
69756 y = (y | (y << 8)) & 0x00FF00FF;
69757 y = (y | (y << 4)) & 0x0F0F0F0F;
69758 y = (y | (y << 2)) & 0x33333333;
69759 y = (y | (y << 1)) & 0x55555555;
69760
69761 return x | (y << 1);
69762}
69763
69764// find the leftmost node of a polygon ring
69765function getLeftmost(start) {

Callers 2

isEarHashedFunction · 0.70
indexCurveFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected