mirror of
https://github.com/JustinSDK/dotSCAD.git
synced 2025-09-25 13:59:04 +02:00
Szudzik function
This commit is contained in:
@@ -1 +1,11 @@
|
||||
function _pt3_hash(p) = floor(abs(p * [73856093, 19349669, 83492791]));
|
||||
function _pt3_hash(p) =
|
||||
let(
|
||||
x = p.x >= 0 ? 2 * p.x : -2 * p.x - 1,
|
||||
y = p.y >= 0 ? 2 * p.y : -2 * p.y - 1,
|
||||
z = p.z >= 0 ? 2 * p.z : -2 * p.z - 1,
|
||||
mx = max(x, y, z),
|
||||
hash = mx ^ 3 + (2 * mx * z) + z
|
||||
)
|
||||
mx == z ? hash + max(x, y) ^ 2 :
|
||||
y >= x ? hash + x + y :
|
||||
hash + y;
|
Reference in New Issue
Block a user