MCPcopy Create free account
hub / github.com/BabylonJS/BabylonNative / zOrder

Function zOrder

Apps/BabylonScripts/meshwriter.min.js:5822–5838  ·  view source on GitHub ↗
(x, y, minX, minY, invSize)

Source from the content-addressed store, hash-verified

5820
5821 // z-order of a point given coords and inverse of the longer side of data bbox
5822 function zOrder(x, y, minX, minY, invSize) {
5823 // coords are transformed into non-negative 15-bit integer range
5824 x = 32767 * (x - minX) * invSize;
5825 y = 32767 * (y - minY) * invSize;
5826
5827 x = (x | (x << 8)) & 0x00FF00FF;
5828 x = (x | (x << 4)) & 0x0F0F0F0F;
5829 x = (x | (x << 2)) & 0x33333333;
5830 x = (x | (x << 1)) & 0x55555555;
5831
5832 y = (y | (y << 8)) & 0x00FF00FF;
5833 y = (y | (y << 4)) & 0x0F0F0F0F;
5834 y = (y | (y << 2)) & 0x33333333;
5835 y = (y | (y << 1)) & 0x55555555;
5836
5837 return x | (y << 1);
5838 }
5839
5840 // find the leftmost node of a polygon ring
5841 function getLeftmost(start) {

Callers 2

isEarHashedFunction · 0.85
indexCurveFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected