@studiometa/js-toolkit
Version:
A set of useful little bits of JavaScript to boost your project! 🚀
24 lines (23 loc) • 827 B
TypeScript
/**
* @typedef {Object} Rect
* @property {number} x Rectangle's x position
* @property {number} y Rectangle's y position
* @property {number} width Rectangle's width
* @property {number} height Rectangle's height
*/
/**
* @typedef {Object} Circle
* @property {number} x Circle's x position
* @property {number} y Circle's y position
* @property {number} radius Circle's radius
*/
/**
* Test if a circle collides with a rectangle.
* Inspired by http://www.jeffreythompson.org/collision-detection/circle-rect.php
*
* @param {Circle} circle Circle
* @param {Rect} rect Rectangle
* @return {boolean} Are the sides of the circle touching the rectangle ?
* @link https://js-toolkit.studiometa.dev/utils/collision/collideCircleRect.html
*/
export declare function collideCircleRect(circle: any, rect: any): boolean;