flight-planner
Version:
Plan and route VFR flights
100 lines (99 loc) • 3.66 kB
TypeScript
import { Cloud, Wind } from './metar.types.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 const calculateWindVector: (wind: Wind, trueTrack: number) => WindVector;
/**
* Calculates True Airspeed.
*
* @param indicatedAltitudeFt Indicated altitude in feet.
* @param qnhHpa Altimeter setting in hPa.
* @param oatCelsius Outside Air Temperature in Celsius.
* @param kcas Knots Calibrated Airspeed (or KEAS if compressibility is negligible).
* @returns Knots True Airspeed.
*/
export declare const calculateTrueAirspeed: (indicatedAltitudeFt: number, qnhHpa: number, oatCelsius: number, kcas: number) => number;
/**
* 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 const 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 const calculateGroundspeed: (wind: Wind, airSpeed: number, heading: number) => number;
/**
* Sorts an array of clouds by their height in ascending order.
*
* @param clouds - The array of clouds to sort
* @returns The sorted array of clouds
*/
export declare const sortClouds: (clouds: Cloud[]) => Cloud[];
/**
* 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;
/**
* 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;
/**
* Generates a Base32 hash key from the given input.
*
* @param input - The input to hash
* @returns The Base32 hash key
*/
export declare const generateBase32HashKey: (input: string) => string;