forked from phaserjs/phaser
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathBetween.js
More file actions
25 lines (23 loc) · 733 Bytes
/
Copy pathBetween.js
File metadata and controls
25 lines (23 loc) · 733 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
25
/**
* @author Richard Davey <rich@photonstorm.com>
* @copyright 2018 Photon Storm Ltd.
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
*/
/**
* Find the angle of a segment from (x1, y1) -> (x2, y2).
*
* @function Phaser.Math.Angle.Between
* @since 3.0.0
*
* @param {number} x1 - The x coordinate of the first point.
* @param {number} y1 - The y coordinate of the first point.
* @param {number} x2 - The x coordinate of the second point.
* @param {number} y2 - The y coordinate of the second point.
*
* @return {number} The angle in radians.
*/
var Between = function (x1, y1, x2, y2)
{
return Math.atan2(y2 - y1, x2 - x1);
};
module.exports = Between;