Bell-shaped seeded noise avoids shells, grids and concentric rings.
(key: string, scale: number)
| 99 | |
| 100 | /** Bell-shaped seeded noise avoids shells, grids and concentric rings. */ |
| 101 | function cloudPoint(key: string, scale: number): Point { |
| 102 | const coordinate = (axis: string) => { |
| 103 | let sum = 0; |
| 104 | for (let i = 0; i < 6; i++) sum += hash(`${key}:${axis}:${i}`) / 0x100000000; |
| 105 | return (sum - 3) * scale; |
| 106 | }; |
| 107 | return { x: coordinate('x'), y: coordinate('y'), z: coordinate('z') }; |
| 108 | } |
| 109 | |
| 110 | const finitePoint = (point: Point) => [point.x, point.y, point.z].every(Number.isFinite); |
| 111 |
no test coverage detected