forked from phaserjs/phaser
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathWithin.js
More file actions
24 lines (22 loc) · 779 Bytes
/
Copy pathWithin.js
File metadata and controls
24 lines (22 loc) · 779 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
/**
* @author Richard Davey <rich@photonstorm.com>
* @copyright 2020 Photon Storm Ltd.
* @license {@link https://opensource.org/licenses/MIT|MIT License}
*/
/**
* Checks if the two values are within the given `tolerance` of each other.
*
* @function Phaser.Math.Within
* @since 3.0.0
*
* @param {number} a - The first value to use in the calculation.
* @param {number} b - The second value to use in the calculation.
* @param {number} tolerance - The tolerance. Anything equal to or less than this value is considered as being within range.
*
* @return {boolean} Returns `true` if `a` is less than or equal to the tolerance of `b`.
*/
var Within = function (a, b, tolerance)
{
return (Math.abs(a - b) <= tolerance);
};
module.exports = Within;