forked from phaserjs/phaser
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathBetweenPointsY.js
More file actions
26 lines (24 loc) · 818 Bytes
/
Copy pathBetweenPointsY.js
File metadata and controls
26 lines (24 loc) · 818 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
26
/**
* @author Richard Davey <rich@photonstorm.com>
* @copyright 2020 Photon Storm Ltd.
* @license {@link https://opensource.org/licenses/MIT|MIT License}
*/
/**
* Find the angle of a segment from (point1.x, point1.y) -> (point2.x, point2.y).
*
* The difference between this method and {@link Phaser.Math.Angle.BetweenPoints} is that this assumes the y coordinate
* travels down the screen.
*
* @function Phaser.Math.Angle.BetweenPointsY
* @since 3.0.0
*
* @param {Phaser.Types.Math.Vector2Like} point1 - The first point.
* @param {Phaser.Types.Math.Vector2Like} point2 - The second point.
*
* @return {number} The angle in radians.
*/
var BetweenPointsY = function (point1, point2)
{
return Math.atan2(point2.x - point1.x, point2.y - point1.y);
};
module.exports = BetweenPointsY;