Press n or j to go to the next uncovered block, b, p or k for the previous block.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | 1x 1x 24x 24x | import { angleUnits, type UnitOptions } from './angle.ts'; /** * Converts degrees to radians. * @param angle - Angle. * @param options - see {@link UnitOptions} * @returns Angle in radians. * @example * ```typescript * toRadians(180); // π * toRadians(90, 'degrees'); // π/2 * toRadians(0.5, 'turns'); // π * ``` * @group Geometry * @category Angle */ export function toRadians(angle: number, { unit = 'degrees' }: UnitOptions = {}): number { return (angleUnits.radians * angle) / angleUnits[unit]; } |