MCPcopy Create free account
hub / github.com/ecto/muni / voxelHash

Function voxelHash

depot/console/src/lib/accumulatedCloudStore.ts:48–55  ·  view source on GitHub ↗

* Spatial hash for a voxel coordinate. Uses a simple Cantor-like hash * to combine 3 integers into a single number for Map lookup.

(vx: number, vy: number, vz: number)

Source from the content-addressed store, hash-verified

46 * to combine 3 integers into a single number for Map lookup.
47 */
48function voxelHash(vx: number, vy: number, vz: number): number {
49 // Offset to handle negatives (shift by large number)
50 const ox = vx + 500000;
51 const oy = vy + 500000;
52 const oz = vz + 500000;
53 // Combine with prime multipliers — collisions are rare at 10cm resolution
54 return (ox * 73856093) ^ (oy * 19349663) ^ (oz * 83492791);
55}
56
57/**
58 * Height-based coloring: blue (ground) -> cyan -> green -> yellow -> red (high).

Callers 1

ingestFrameFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected