diginext-utils
Version:
README.md
20 lines • 742 B
TypeScript
/**
* Calculates the angle in degrees between two points.
* The angle is measured from the positive x-axis.
* Range: (-180, 180]
*
* @param x1 - X coordinate of first point (center)
* @param y1 - Y coordinate of first point (center)
* @param x2 - X coordinate of second point
* @param y2 - Y coordinate of second point
* @returns The angle in degrees, or 0 if not finite
*
* @example
* ```ts
* angleBetweenPoints(0, 0, 1, 0); // 0 (pointing right)
* angleBetweenPoints(0, 0, 0, 1); // 90 (pointing up)
* angleBetweenPoints(0, 0, -1, 0); // 180 or -180 (pointing left)
* ```
*/
export declare function angleBetweenPoints(x1: number, y1: number, x2: number, y2: number): number;
//# sourceMappingURL=angleBetweenPoints.d.ts.map