extract redundant code in helper function

This commit is contained in:
vcoppe
2024-08-13 14:58:15 +02:00
parent 9e6e8c069d
commit 069a598429
4 changed files with 33 additions and 34 deletions

View File

@@ -45,8 +45,8 @@ function ramerDouglasPeuckerRecursive(points: TrackPoint[], epsilon: number, mea
}
}
export function crossarcDistance(point1: TrackPoint, point2: TrackPoint, point3: TrackPoint): number {
return crossarc(point1.getCoordinates(), point2.getCoordinates(), point3.getCoordinates());
export function crossarcDistance(point1: TrackPoint, point2: TrackPoint, point3: TrackPoint | Coordinates): number {
return crossarc(point1.getCoordinates(), point2.getCoordinates(), point3 instanceof TrackPoint ? point3.getCoordinates() : point3);
}
function crossarc(coord1: Coordinates, coord2: Coordinates, coord3: Coordinates): number {