feat: Implement HeightmapGenerator and Voronoi module

- Added HeightmapGenerator class for generating heightmaps with various tools (Hill, Pit, Range, Trough, Strait, etc.).
- Introduced Voronoi class for creating Voronoi diagrams using Delaunator.
- Updated index.html to include new modules.
- Created index.ts to manage module imports.
- Enhanced arrayUtils and graphUtils with type definitions and improved functionality.
- Added utility functions for generating grids and calculating Voronoi cells.
This commit is contained in:
Marc Emmanuel 2026-01-16 13:12:56 +01:00
parent fa493989b6
commit 4b5e9bfeea
8 changed files with 748 additions and 601 deletions

View file

@ -78,7 +78,7 @@ export const getTypedArray = (maxValue: number) => {
* @param {Array} [options.from] - An optional array to create the typed array from
* @returns The created typed array
*/
export const createTypedArray = ({maxValue, length, from}: {maxValue: number; length: number; from?: ArrayLike<number>}) => {
export const createTypedArray = ({maxValue, length, from}: {maxValue: number; length: number; from?: ArrayLike<number>}): Uint8Array | Uint16Array | Uint32Array => {
const typedArray = getTypedArray(maxValue);
if (!from) return new typedArray(length);
return typedArray.from(from);