phaser
Version:
A fast, free and fun HTML5 Game Framework for Desktop and Mobile web browsers from the team at Phaser Studio Inc.
29 lines (25 loc) • 810 B
JavaScript
/**
* @author Richard Davey <rich@phaser.io>
* @copyright 2013-2025 Phaser Studio Inc.
* @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;