Refactoring points

Signed-off-by: Mark Tolmacs <mark@lazycat.hu>
This commit is contained in:
Mark Tolmacs 2024-09-20 21:32:32 +02:00
parent 8ca4cf3260
commit b4cb314090
No known key found for this signature in database
40 changed files with 746 additions and 783 deletions

View file

@ -71,8 +71,8 @@ export const rangeIntersection = (
* Determine if a value is inside a range.
*
* @param value The value to check
* @param range The range
* @returns
* @param range The range to check
* @returns TRUE if the value is in range
*/
export const rangeIncludesValue = (
value: number,
@ -80,3 +80,13 @@ export const rangeIncludesValue = (
): boolean => {
return value >= min && value <= max;
};
/**
* Determine the distance between the start and end of the range.
*
* @param range The range of which to measure the extent of
* @returns The scalar distance or extent of the start and end of the range
*/
export function rangeExtent([a, b]: InclusiveRange) {
return Math.abs(a - b);
}