mirror of
https://github.com/photonstorm/phaser
synced 2024-12-26 13:03:36 +00:00
28 lines
782 B
JavaScript
28 lines
782 B
JavaScript
/**
|
|
* @author Richard Davey <rich@photonstorm.com>
|
|
* @copyright 2019 Photon Storm Ltd.
|
|
* @license {@link https://opensource.org/licenses/MIT|MIT License}
|
|
*/
|
|
|
|
var Angle = require('./Angle');
|
|
var NormalAngle = require('./NormalAngle');
|
|
|
|
/**
|
|
* Calculate the reflected angle between two lines.
|
|
*
|
|
* This is the outgoing angle based on the angle of Line 1 and the normalAngle of Line 2.
|
|
*
|
|
* @function Phaser.Geom.Line.ReflectAngle
|
|
* @since 3.0.0
|
|
*
|
|
* @param {Phaser.Geom.Line} lineA - The first line.
|
|
* @param {Phaser.Geom.Line} lineB - The second line.
|
|
*
|
|
* @return {number} The reflected angle between each line.
|
|
*/
|
|
var ReflectAngle = function (lineA, lineB)
|
|
{
|
|
return (2 * NormalAngle(lineB) - Math.PI - Angle(lineA));
|
|
};
|
|
|
|
module.exports = ReflectAngle;
|