package.math.d.ts Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of ol Show documentation
Show all versions of ol Show documentation
OpenLayers mapping library
The newest version!
/**
* @module ol/math
*/
/**
* Takes a number and clamps it to within the provided bounds.
* @param {number} value The input number.
* @param {number} min The minimum value to return.
* @param {number} max The maximum value to return.
* @return {number} The input number if it is within bounds, or the nearest
* number within the bounds.
*/
export function clamp(value: number, min: number, max: number): number;
/**
* Returns the square of the closest distance between the point (x, y) and the
* line segment (x1, y1) to (x2, y2).
* @param {number} x X.
* @param {number} y Y.
* @param {number} x1 X1.
* @param {number} y1 Y1.
* @param {number} x2 X2.
* @param {number} y2 Y2.
* @return {number} Squared distance.
*/
export function squaredSegmentDistance(x: number, y: number, x1: number, y1: number, x2: number, y2: number): number;
/**
* Returns the square of the distance between the points (x1, y1) and (x2, y2).
* @param {number} x1 X1.
* @param {number} y1 Y1.
* @param {number} x2 X2.
* @param {number} y2 Y2.
* @return {number} Squared distance.
*/
export function squaredDistance(x1: number, y1: number, x2: number, y2: number): number;
/**
* Solves system of linear equations using Gaussian elimination method.
*
* @param {Array>} mat Augmented matrix (n x n + 1 column)
* in row-major order.
* @return {Array|null} The resulting vector.
*/
export function solveLinearSystem(mat: Array>): Array | null;
/**
* Converts radians to to degrees.
*
* @param {number} angleInRadians Angle in radians.
* @return {number} Angle in degrees.
*/
export function toDegrees(angleInRadians: number): number;
/**
* Converts degrees to radians.
*
* @param {number} angleInDegrees Angle in degrees.
* @return {number} Angle in radians.
*/
export function toRadians(angleInDegrees: number): number;
/**
* Returns the modulo of a / b, depending on the sign of b.
*
* @param {number} a Dividend.
* @param {number} b Divisor.
* @return {number} Modulo.
*/
export function modulo(a: number, b: number): number;
/**
* Calculates the linearly interpolated value of x between a and b.
*
* @param {number} a Number
* @param {number} b Number
* @param {number} x Value to be interpolated.
* @return {number} Interpolated value.
*/
export function lerp(a: number, b: number, x: number): number;
/**
* Returns a number with a limited number of decimal digits.
* @param {number} n The input number.
* @param {number} decimals The maximum number of decimal digits.
* @return {number} The input number with a limited number of decimal digits.
*/
export function toFixed(n: number, decimals: number): number;
/**
* Rounds a number to the nearest integer value considering only the given number
* of decimal digits (with rounding on the final digit).
* @param {number} n The input number.
* @param {number} decimals The maximum number of decimal digits.
* @return {number} The nearest integer.
*/
export function round(n: number, decimals: number): number;
/**
* Rounds a number to the next smaller integer considering only the given number
* of decimal digits (with rounding on the final digit).
* @param {number} n The input number.
* @param {number} decimals The maximum number of decimal digits.
* @return {number} The next smaller integer.
*/
export function floor(n: number, decimals: number): number;
/**
* Rounds a number to the next bigger integer considering only the given number
* of decimal digits (with rounding on the final digit).
* @param {number} n The input number.
* @param {number} decimals The maximum number of decimal digits.
* @return {number} The next bigger integer.
*/
export function ceil(n: number, decimals: number): number;
//# sourceMappingURL=math.d.ts.map