2019-11-19 23:24:16 +00:00
|
|
|
/**
|
|
|
|
* @author samme
|
2020-01-15 12:07:09 +00:00
|
|
|
* @copyright 2020 Photon Storm Ltd.
|
2019-11-19 23:24:16 +00:00
|
|
|
* @license {@link https://opensource.org/licenses/MIT|MIT License}
|
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Calculate the distance between two points.
|
|
|
|
*
|
|
|
|
* @function Phaser.Math.Distance.BetweenPoints
|
|
|
|
* @since 3.22.0
|
|
|
|
*
|
|
|
|
* @param {Phaser.Types.Math.Vector2Like} a - The first point.
|
|
|
|
* @param {Phaser.Types.Math.Vector2Like} b - The second point.
|
|
|
|
*
|
|
|
|
* @return {number} The distance between the points.
|
|
|
|
*/
|
|
|
|
var DistanceBetweenPoints = function (a, b)
|
|
|
|
{
|
|
|
|
var dx = a.x - b.x;
|
|
|
|
var dy = a.y - b.y;
|
|
|
|
|
|
|
|
return Math.sqrt(dx * dx + dy * dy);
|
|
|
|
};
|
|
|
|
|
|
|
|
module.exports = DistanceBetweenPoints;
|