23 static uint xors[4][32] = {
24 {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
25 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
26 {0x00000000, 0x00000001, 0x00000001, 0x00000007, 0x00000001, 0x00000013, 0x00000015,
27 0x0000007f, 0x00000001, 0x00000103, 0x00000105, 0x0000070f, 0x00000111, 0x00001333,
28 0x00001555, 0x00007fff, 0x00000001, 0x00010003, 0x00010005, 0x0007000f, 0x00010011,
29 0x00130033, 0x00150055, 0x007f00ff, 0x00010101, 0x01030303, 0x01050505, 0x070f0f0f,
30 0x01111111, 0x13333333, 0x15555555, 0x7fffffff},
31 {0x00000000, 0x00000001, 0x00000003, 0x00000001, 0x00000005, 0x0000001f, 0x0000002b,
32 0x0000003d, 0x00000011, 0x00000133, 0x00000377, 0x00000199, 0x00000445, 0x00001ccf,
33 0x00002ddb, 0x0000366d, 0x00000101, 0x00010303, 0x00030707, 0x00010909, 0x00051515,
34 0x001f3f3f, 0x002b6b6b, 0x003dbdbd, 0x00101011, 0x01303033, 0x03707077, 0x01909099,
35 0x04515145, 0x1cf3f3cf, 0x2db6b6db, 0x36dbdb6d},
36 {0x00000000, 0x00000001, 0x00000000, 0x00000003, 0x0000000d, 0x0000000c, 0x00000005,
37 0x0000004f, 0x00000014, 0x000000e7, 0x00000329, 0x0000039c, 0x00000011, 0x00001033,
38 0x00000044, 0x000030bb, 0x0000d1cd, 0x0000c2ec, 0x00005415, 0x0004fc3f, 0x00015054,
39 0x000e5c97, 0x0032e5b9, 0x0039725c, 0x00000101, 0x01000303, 0x00000404, 0x03000b0b,
40 0x0d001d1d, 0x0c002c2c, 0x05004545, 0x4f00cfcf},
54 for (
int log_N = 0,
N = 1;
N <
size; log_N++,
N *= 2) {
55 float strata_count = (
float)(
N * 2);
56 for (
int i = 0; i <
N && (
N + i) < size; i++) {
58 uint occupied_x_stratum = (
uint)(points[i ^ xors[0][log_N]].x * strata_count);
59 uint occupied_y_stratum = (
uint)(points[i ^ xors[1][log_N]].y * strata_count);
60 uint occupied_z_stratum = (
uint)(points[i ^ xors[2][log_N]].
z * strata_count);
61 uint occupied_w_stratum = (
uint)(points[i ^ xors[3][log_N]].
w * strata_count);
64 points[
N + i].x = ((
float)(occupied_x_stratum ^ 1) +
hash_hp_float(rng_i++)) / strata_count;
65 points[
N + i].y = ((
float)(occupied_y_stratum ^ 1) +
hash_hp_float(rng_i++)) / strata_count;
66 points[
N + i].z = ((
float)(occupied_z_stratum ^ 1) +
hash_hp_float(rng_i++)) / strata_count;
67 points[
N + i].w = ((
float)(occupied_w_stratum ^ 1) +
hash_hp_float(rng_i++)) / strata_count;