@types/poisson-disk-sampling
Advanced tools
Comparing version 2.2.0 to 2.2.1
// Type definitions for poisson-disk-sampling 2.2 | ||
// Project: https://github.com/kchapelier/poisson-disk-sampling | ||
// Definitions by: Aliyss <https://github.com/Aliyss> | ||
// Dmitry Semigradsky <https://github.com/Semigradsky> | ||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped | ||
@@ -9,2 +10,4 @@ | ||
type Point = number[]; | ||
declare class PoissonDiskSampling { | ||
@@ -16,18 +19,81 @@ shape: number[]; | ||
options: { | ||
/** | ||
* Shape of the space | ||
*/ | ||
shape: number[]; | ||
/** | ||
* Minimum distance between each points | ||
*/ | ||
minDistance: number; | ||
maxDistance?: number; | ||
tries?: number; | ||
distanceFunction?: ((...params: number[]) => number) | null; | ||
bias?: ((...params: number[]) => number) | null; | ||
/** | ||
* Maximum distance between each points | ||
* @default (minDistance * 2) | ||
*/ | ||
maxDistance?: number | undefined; | ||
/** | ||
* Number of times the algorithm will try to place a point in the neighbourhood of another points | ||
* @default 30 | ||
*/ | ||
tries?: number | undefined; | ||
/** | ||
* Function to control the distance between each point depending on their position, | ||
* must return a value between 0 and 1 | ||
*/ | ||
distanceFunction?: ((point: Point) => number) | null | undefined; | ||
/** | ||
* When using a `distanceFunction`, will indicate which point constraint takes priority when evaluating two points | ||
* (0 for the lowest distance, 1 for the highest distance) | ||
* @default 0 | ||
*/ | ||
bias?: number | undefined; | ||
}, | ||
rng?: ((...params: number[]) => number) | null, | ||
/** | ||
* RNG function | ||
* @default Math.random | ||
*/ | ||
rng?: (() => number) | null, | ||
); | ||
addRandomPoint(): number[]; | ||
addPoint(point: number[]): number[] | null; | ||
next(): number[] | null; | ||
fill(): number[][]; | ||
getAllPoints(): number[][]; | ||
getAllPointsWithDistance(): number[][]; | ||
/** | ||
* Add a totally random point in the grid | ||
* @returns The point added to the grid | ||
*/ | ||
addRandomPoint(): Point; | ||
/** | ||
* Add a given point to the grid | ||
* @param point Point | ||
* @returns The point added to the grid, `null` if the point is out of the bound or not of the correct dimension | ||
*/ | ||
addPoint(point: Point): Point | null; | ||
/** | ||
* Try to generate a new point in the grid, returns `null` if it wasn't possible | ||
* @returns The added point or null | ||
*/ | ||
next(): Point | null; | ||
/** | ||
* Automatically fill the grid, adding a random point to start the process if needed. | ||
* Will block the thread, probably best to use it in a web worker or child process. | ||
* @returns Sample points | ||
*/ | ||
fill(): Point[]; | ||
/** | ||
* Get all the points in the grid. | ||
* @returns Sample points | ||
*/ | ||
getAllPoints(): Point[]; | ||
/** | ||
* Get all the points in the grid along with the result of the distance function. | ||
* @throws Will throw an error if a distance function was not provided to the constructor. | ||
* @returns Sample points with their distance function result | ||
*/ | ||
getAllPointsWithDistance(): Point[]; | ||
/** | ||
* Reinitialize the grid as well as the internal state | ||
*/ | ||
reset(): void; | ||
@@ -34,0 +100,0 @@ } |
{ | ||
"name": "@types/poisson-disk-sampling", | ||
"version": "2.2.0", | ||
"version": "2.2.1", | ||
"description": "TypeScript definitions for poisson-disk-sampling", | ||
@@ -12,2 +12,7 @@ "homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/poisson-disk-sampling", | ||
"githubUsername": "Aliyss" | ||
}, | ||
{ | ||
"name": "Dmitry Semigradsky", | ||
"url": "https://github.com/Semigradsky", | ||
"githubUsername": "Semigradsky" | ||
} | ||
@@ -24,4 +29,4 @@ ], | ||
"dependencies": {}, | ||
"typesPublisherContentHash": "533fc170262689838e138a52080e02429b69ab17f4c29e7f4123d342b6857dca", | ||
"typeScriptVersion": "3.6" | ||
"typesPublisherContentHash": "26139245f454e311786ad9de90c76f7bfff95e49f3704474c0b1c1526be54e22", | ||
"typeScriptVersion": "4.1" | ||
} |
@@ -11,3 +11,3 @@ # Installation | ||
### Additional Details | ||
* Last updated: Thu, 01 Jul 2021 17:01:27 GMT | ||
* Last updated: Wed, 23 Nov 2022 18:11:55 GMT | ||
* Dependencies: none | ||
@@ -17,2 +17,2 @@ * Global values: none | ||
# Credits | ||
These definitions were written by [Aliyss](https://github.com/Aliyss). | ||
These definitions were written by [Aliyss](https://github.com/Aliyss), and [Dmitry Semigradsky](https://github.com/Semigradsky). |
8062
151