@technobuddha/library
Version:
A large library of useful functions
29 lines (28 loc) • 872 B
TypeScript
import { type Polygon } from './@types/geometry.ts';
/**
* Generate normalized edge angles from polygon edges.
* @param polygon - The polygon to extract edge angles from
* @param normalizeTo - Angle to normalize to (e.g., Math.PI * 2 for full rotation, Math.PI / 2 for quadrant)
* @returns Generator that yields edge angles, normalized to the specified range
* @example
* ```typescript
* const polygon: Polygon = [
* { x: 0, y: 0 },
* { x: 1, y: 1 },
* { x: 0, y: 2 },
* { x: -1, y: 1 }
* ];
* const angles = edgeAngles(polygon);
* for (const angle of angles) {
* console.log(angle);
* }
* // Output:
* // 0.7853981633974483
* // 2.356194490192345
* // 3.9269908169872414
* // 5.497787143782138
* ```
* @group Geometry
* @category Polygon
*/
export declare function edgeAngles(polygon: Polygon, normalizeTo?: number): Generator<number>;