mirror of
https://github.com/photonstorm/phaser
synced 2025-01-03 00:38:46 +00:00
28 lines
718 B
JavaScript
28 lines
718 B
JavaScript
/**
|
|
* @author Richard Davey <rich@photonstorm.com>
|
|
* @copyright 2018 Photon Storm Ltd.
|
|
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
|
|
*/
|
|
|
|
/**
|
|
* [description]
|
|
*
|
|
* @function Phaser.Math.Distance.Power
|
|
* @since 3.0.0
|
|
*
|
|
* @param {number} x1 - [description]
|
|
* @param {number} y1 - [description]
|
|
* @param {number} x2 - [description]
|
|
* @param {number} y2 - [description]
|
|
* @param {number} pow - [description]
|
|
*
|
|
* @return {number} [description]
|
|
*/
|
|
var DistancePower = function (x1, y1, x2, y2, pow)
|
|
{
|
|
if (pow === undefined) { pow = 2; }
|
|
|
|
return Math.sqrt(Math.pow(x2 - x1, pow) + Math.pow(y2 - y1, pow));
|
|
};
|
|
|
|
module.exports = DistancePower;
|