@dartbot/dartboard
Version:
Dartboard implemented as a vanilla web component
56 lines (55 loc) • 1.72 kB
TypeScript
/**
* Point in the polar coordinate system
* represented as a radius and an angle
*/
export interface PolarPoint {
radius: number;
angle: number;
}
/**
* Point in the Cartesian coordinate system
* represented as an x and y coordinate
*/
export interface Point {
x: number;
y: number;
}
/**
* Gets a Cartesian point (x, y) from a polar point
*/
export declare const getPoint: (point: PolarPoint) => Point;
/**
* Gets a polar point from Cartesian coordinates
* @param x Cartesian X coordinate
* @param y Cartesian Y coordinate
* @returns Polar point representation of the cartesian coordinate
*/
export declare const getPolar: (x: number, y: number) => PolarPoint;
/**
* Get the X value of the Cartesian point
* @param point Polar point to convert to cartesian
* @returns X value of the cartesian point
*/
export declare const getX: (point: PolarPoint) => number;
/**
* Get the Y value of the Cartesian point
* @param point Polar point to convert to cartesian
* @returns Y value of the cartesian point
*/
export declare const getY: (point: PolarPoint) => number;
/**
* Returns a polar point that is the vector of the two other points
*/
export declare const addPolar: (p1: PolarPoint, p2: PolarPoint) => PolarPoint;
/**
* Returns true if the point is valid. A valid point is a point
* where the radius and angle are both finite numbers
* @param p Polar point with radius and angle
*/
export declare const isValidPolar: (p: PolarPoint) => boolean;
/**
* Returns true if the point is valid. A valid point is
* one where the x and y coordinates are both finite numbers
* @param p Cartesian point with x and y coordinates
*/
export declare const isValidPoint: (p: Point) => boolean;