@amandaghassaei/vector-math
Version:
A minimal vector math library to handle 2D/3D translations and rotations, written in TypeScript.
22 lines (19 loc) • 649 B
text/typescript
/**
* Default numerical tolerance for all mathematical operations and equality checks.
*/
export const DEFAULT_NUMERICAL_TOLERANCE = 1e-15;
let numericalTolerance = DEFAULT_NUMERICAL_TOLERANCE;
/**
* Set global numerical tolerance for all mathematical operations and equality checks.
* Default numerical tolerance is 1e-15.
* @param tolerance - Numerical tolerance to set.
*/
export function setNumericalTolerance(tolerance: number) {
numericalTolerance = tolerance;
}
/**
* Get global numerical tolerance for all mathematical operations and equality checks.
*/
export function NUMERICAL_TOLERANCE() {
return numericalTolerance;
}