Fix pointDistanceSq

Signed-off-by: Mark Tolmacs <mark@lazycat.hu>
This commit is contained in:
Mark Tolmacs 2024-10-08 09:55:35 +02:00
parent a177d33121
commit 1e819a2acf
No known key found for this signature in database

View file

@ -213,7 +213,7 @@ export function pointDistance<P extends GenericPoint>(a: P, b: P): number {
* @returns The euclidean distance between the two points. * @returns The euclidean distance between the two points.
*/ */
export function pointDistanceSq<P extends GenericPoint>(a: P, b: P): number { export function pointDistanceSq<P extends GenericPoint>(a: P, b: P): number {
return Math.hypot(b[0] - a[0], b[1] - a[1]); return Math.pow(b[0] - a[0], 2) + Math.pow(b[1] - a[1], 2);
} }
/** /**