UNPKG

flight-planner

Version:

Plan and route VFR flights

83 lines (82 loc) 3 kB
import { Wind } from "./metar.js"; /** * Represents a wind vector with angle and decomposed components. * * @interface WindVector * @property {number} angle - The angle of the wind in degrees. * @property {number} headwind - The headwind component of the wind vector. * @property {number} crosswind - The crosswind component of the wind vector. */ export interface WindVector { angle: number; headwind: number; crosswind: number; } /** * Calculates the wind vector relative to the given true track. * * @param wind - An object representing the wind, containing direction and speed. * @param trueTrack - The current true track in degrees. * @returns An object containing the wind angle, headwind, and crosswind components. */ export declare function calculateWindVector(wind: Wind, trueTrack: number): WindVector; /** * Calculates the wind correction angle for the given wind, true track, and airspeed. * * @param wind - An object representing the wind, containing direction and speed. * @param trueTrack - The true track in degrees. * @param airSpeed - The airspeed in knots. * @returns The wind correction angle in degrees. */ export declare function calculateWindCorrectionAngle(wind: Wind, trueTrack: number, airSpeed: number): number; /** * Calculates the groundspeed for the given wind, airspeed, and heading. * * @param wind - An object representing the wind, containing degrees and speed. * @param airSpeed - The airspeed in knots. * @param heading - The heading in degrees. * @returns The groundspeed in knots. */ export declare function calculateGroundspeed(wind: Wind, airSpeed: number, heading: number): number; /** * Checks if the given string is a valid ICAO code. * * @param icao - The string to check * @returns True if the string is a valid ICAO code, false otherwise */ export declare const isICAO: (icao: string) => boolean; /** * Normalizes the given ICAO code to uppercase. * * @param icao - The ICAO code to normalize * @returns The normalized ICAO code */ export declare const normalizeICAO: (icao: string) => string; /** * Checks if the given string is a valid IATA code. * * @param iata - The string to check * @returns True if the string is a valid IATA code, false otherwise */ export declare const isIATA: (iata: string) => boolean; /** * Normalizes the given IATA code to uppercase. * * @param iata - The IATA code to normalize * @returns The normalized IATA code */ export declare const normalizeIATA: (iata: string) => string; /** * Normalizes the given track angle to a value between 0 and 360 degrees. * * @param track - The track angle to normalize * @returns The normalized track angle */ export declare const normalizeTrack: (track: number) => number; /** * Capitalizes the first letter of each word in a string * * @param text - The input text to capitalize * @returns The text with the first letter of each word capitalized */ export declare const capitalizeWords: (text: string) => string;