diff --git a/tests/domain/scene-paths.test.ts b/tests/domain/scene-paths.test.ts index eb63df82..39aec67e 100644 --- a/tests/domain/scene-paths.test.ts +++ b/tests/domain/scene-paths.test.ts @@ -3,6 +3,7 @@ import { describe, expect, it } from "vitest"; import { createScenePath, getScenePathLength, + mapWorldPointToScenePathProgressBetweenPoints, resolveNearestPointOnResolvedScenePath, resolveScenePath, sampleResolvedScenePathPosition, @@ -233,4 +234,36 @@ describe("scene paths", () => { } }); }); + + it("maps world points between authored track points into clamped rail progress", () => { + expect( + mapWorldPointToScenePathProgressBetweenPoints({ + point: { + x: 12, + y: 1, + z: 2 + }, + trackStartPoint: { + x: 0, + y: 1, + z: 2 + }, + trackEndPoint: { + x: 10, + y: 1, + z: 2 + }, + railStartProgress: 0.25, + railEndProgress: 0.75 + }) + ).toEqual({ + trackProgress: 1, + railProgress: 0.75, + projectedTrackPosition: { + x: 10, + y: 1, + z: 2 + } + }); + }); });