UNPKG

playcanvas

Version:

PlayCanvas WebGL game engine

44 lines (43 loc) 2.19 kB
export namespace random { /** * Return a pseudo-random 2D point inside a unit circle with uniform distribution. * * @param {Vec2} point - The returned generated point. */ function circlePoint(point: Vec2): void; /** * Generates evenly distributed deterministic points inside a unit circle using Fermat's spiral * and Vogel's method. * * @param {Vec2} point - The returned generated point. * @param {number} index - Index of the point to generate, in the range from 0 to numPoints - 1. * @param {number} numPoints - The total number of points of the set. */ function circlePointDeterministic(point: Vec2, index: number, numPoints: number): void; /** * Generates evenly distributed deterministic points on a unit sphere using Fibonacci sphere * algorithm. It also allows the points to cover only part of the sphere by specifying start * and end parameters, representing value from 0 (top of the sphere) and 1 (bottom of the * sphere). For example by specifying 0.4 and 0.6 and start and end, a band around the equator * would be generated. * * @param {Vec3} point - The returned generated point. * @param {number} index - Index of the point to generate, in the range from 0 to numPoints - 1. * @param {number} numPoints - The total number of points of the set. * @param {number} [start] - Part on the sphere along y axis to start the points, in the range * of 0 and 1. Defaults to 0. * @param {number} [end] - Part on the sphere along y axis to stop the points, in the range of * 0 and 1. Defaults to 1. */ function spherePointDeterministic(point: Vec3, index: number, numPoints: number, start?: number, end?: number): void; /** * Generate a repeatable pseudo-random sequence using radical inverse. Based on * http://holger.dammertz.org/stuff/notes_HammersleyOnHemisphere.html * * @param {number} i - The index in the sequence to return. * @returns {number} The pseudo-random value. */ function radicalInverse(i: number): number; } import type { Vec2 } from './vec2.js'; import type { Vec3 } from './vec3.js';