ridder
Version:
A straightforward game engine for simple data-driven games in JavaScript
33 lines (32 loc) • 1.08 kB
TypeScript
export type Circle = {
x: number;
y: number;
r: number;
};
/**
* Create a new circle data structure.
* @param x - The x-coordinate.
* @param y - The y-coordinate.
* @param r - The radius.
*/
export declare function circle(x?: number, y?: number, r?: number): Circle;
/**
* Set the components of the circle and returns the circle.
*/
export declare function setCircle(c: Circle, x: number, y: number, r: number): Circle;
/**
* Returns `true` if the circle has a radius larger than 0.
*/
export declare function isCircleValid(c: Circle): boolean;
/**
* Returns `true` when the circles {@link a} and {@link b} intersect (overlap).
*/
export declare function doCirclesIntersect(a: Circle, b: Circle): boolean;
/**
* Returns `true` when {@link x} and {@link y} are inside the circle {@link c}.
*/
export declare function doesCircleContain(c: Circle, x: number, y: number): boolean;
/**
* Copy the data components of circle {@link b} into circle {@link a} and returns polygon {@link a}.
*/
export declare function copyCircle(a: Circle, b: Circle): Circle;