UNPKG

@technobuddha/library

Version:
18 lines (17 loc) 676 B
import { type LineSegment } from './@types/geometry.ts'; import { type UnitOptions } from './angle.ts'; /** * Calculates the angle of a given line segment, relative to the horizontal axis * @param line - The line segment for which to calculate the angle. * @param options - see {@link UnitOptions} * @returns The angle of the line segment in the specified units. * @example * ```ts * angleOfLine({ x0: 0, y0: 0, x1: 10, y1: 10 }); // π/4 * angleOfLine({ x0: 0, y0: 0, x1: 10, y1: 10 }, 'degrees'); // 45 * ``` * @group Geometry * @category Line Segment * @category Angle */ export declare function angleOfLine(line: LineSegment, { unit }?: UnitOptions): number;