31 lines
761 B
TypeScript
31 lines
761 B
TypeScript
import * as geolib from "geolib";
|
|
import { handleTurnAtFix } from "../pathGenerators/handleTurnAtFix.ts";
|
|
import { computeSpeed } from "../utils/computeSpeed.ts";
|
|
|
|
// NOTE: No wind adjustments to be made, no clue how *that* would draw
|
|
export const TerminatorsVM = (
|
|
leg: VMTerminalEntry,
|
|
previousFix: NavFix,
|
|
lastCourse: number
|
|
): [NavFix?, LineSegment[]?] => {
|
|
const speed = computeSpeed(leg, previousFix);
|
|
|
|
const endpoint = geolib.computeDestinationPoint(
|
|
previousFix,
|
|
(10).toMetre(),
|
|
leg.Course.toTrue(previousFix)
|
|
);
|
|
|
|
const line = handleTurnAtFix(
|
|
leg.Course.toTrue(previousFix),
|
|
leg.Course.toTrue(previousFix),
|
|
lastCourse,
|
|
previousFix,
|
|
endpoint,
|
|
speed,
|
|
leg.TurnDir
|
|
);
|
|
|
|
return [undefined, line];
|
|
};
|