Interpolate driver coordinates
Interpolate a driver coordinate between timestamped samples with clamped progress and shortest-path longitude wrapping.Description
Requirements
Export interpolateDriverCoordinates from src/App.js.
Use the earlier and later timestamp regardless of input order.
Return the nearest endpoint outside the sample interval.
Interpolate latitude linearly by normalized elapsed time.
Interpolate longitude across the shortest dateline path and normalize to minus 180 through 180.
Return an observably equivalent result for equivalent inputs without reading time, randomness, network, storage, or DOM globals.
Do not mutate input objects, arrays, nested records, or values retained in the returned result.
Midpoint
Samples (0,0) at 0 and (10,20) at 10; at is 5
Coordinate is latitude 5 longitude 10
Use the earlier and later timestamp regardless of input order.
Dateline
Longitude 179 moves to -179
The midpoint lies at 180 or -180, not zero
Return the nearest endpoint outside the sample interval.
Constraints
Implement a pure synchronous function with no external side effectsTreat every input collection and nested record as read-onlyReturn JSON-compatible data except where the declared TypeScript API explicitly uses bigint
Hints
Hint 1
Start with the orders-sample-endpoints behavior and make its observable result deterministic.
Hint 2
Model clamps-sample-time independently before combining it with the remaining states.
Hint 3
Verify the boundary described by wraps-longitude without changing caller-owned input.