@studiometa/js-toolkit
Version:
A set of useful little bits of JavaScript to boost your project! 🚀
23 lines (22 loc) • 747 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
* @returns {boolean} Are the sides of the circle touching the rectangle ?
*/
export declare function collideCircleRect(circle: any, rect: any): boolean;