UNPKG

ski-din-calculator

Version:

Calculate a skier's DIN binding release value based on height, weight, age, skill level, and boot sole length

67 lines (66 loc) 1.96 kB
/** * Skier profile interface for the class-based DIN calculator. * Note: This uses Imperial units (inches/pounds) unlike the function-based calculator. */ export interface SkierProfile { /** Height in inches */ height: number; /** Weight in pounds */ weight: number; /** Age in years */ age: number; /** Skill level: 1 (Cautious), 2 (Moderate), 3 (Aggressive) */ skill: number; /** Boot sole length in millimeters */ soleLength: number; } /** * Class-based DIN calculator using traditional ISO 11088 standard. * * This calculator uses Imperial units (inches/pounds) and provides a different * approach compared to the function-based calculator which uses metric units. * * @example * ```typescript * const calculator = new DinCalculator(); * const profile: SkierProfile = { * height: 70, // inches * weight: 160, // pounds * age: 25, * skill: 2, // moderate * soleLength: 305 // mm * }; * const dinValue = calculator.calculateDIN(profile); * ``` */ export declare class DinCalculator { private skierCodes; private dins; /** * Determines the index for height based on the skier's height in inches. */ private getHeightIndex; /** * Determines the index for weight based on the skier's weight in pounds. */ private getWeightIndex; /** * Determines the skier code based on height and weight. */ private getSkierCode; /** * Adjusts the skier code based on the skier's age and skill level. */ private adjustSkierCodeForAgeAndSkill; /** * Converts the sole length into an index for the DIN table. */ private getSoleLengthIndex; /** * Calculates the DIN setting based on the skier's profile. * * @param profile - Skier profile with Imperial measurements * @returns DIN value or null if no suitable setting found */ calculateDIN(profile: SkierProfile): number | null; }