UNPKG

arx-level-generator

Version:
45 lines (44 loc) 2.08 kB
import { Box3, BufferGeometry, Object3D, Vector3 as ThreeJsVector3 } from 'three'; import { Vector3 } from './Vector3.js'; export type PackageJsonProps = { name: string; version: string; description: string; author: string; homepage: string; }; export declare const getGeneratorPackageJSON: () => Promise<PackageJsonProps>; export declare const getProjectPackageJSON: () => Promise<PackageJsonProps>; export declare const evenAndRemainder: (divisor: number, n: number) => [number, number]; export declare const applyTransformations: (threeJsObj: Object3D) => void; export declare const percentOf: (percentage: number, maxValue: number) => number; /** * @see https://en.wikipedia.org/wiki/ISO/IEC_8859-15 */ export declare const latin9ToLatin1: (str: string) => string; export declare const roundToNDecimals: (decimals: number, x: number) => number; export declare const isEven: (n: number) => boolean; export declare const isOdd: (n: number) => boolean; export declare const averageVectors: (vectors: ThreeJsVector3[]) => Vector3; /** inclusive */ export declare const isBetween: (min: number, max: number, n: number) => boolean; export declare const fileExists: (filename: string) => Promise<boolean>; export declare const circleOfVectors: (center: ThreeJsVector3, radius: number, divisions: number, theta?: number) => Vector3[]; export declare const normalizeDegree: (degree: number) => number; export declare const numberOfVertices: (geometry: BufferGeometry) => number; /** * Expands a 3D point into a Box3 object with the given size * * @param point - the center of the box * @param size - sidelength/diameter of the box * @returns the generated Box3 object */ export declare const pointToBox: (point: Vector3, size: number | Vector3) => Box3; /** * This function also cuts the array to the given size! * * `arrayPadRight(4, undefined, [1, 2]) -> [1, 2, undefined, undefined]` * * `arrayPadRight(4, undefined, [1, 2, 3, 4, 5, 6]) -> [1, 2, 3, 4]` */ export declare const arrayPadRight: <T>(length: number, paddingValue: T, array: T[]) => T[];