phaser4-rex-plugins
Version:
28 lines (23 loc) • 769 B
JavaScript
/**
* @author Richard Davey <rich@photonstorm.com>
* @copyright 2019 Photon Storm Ltd.
* @license {@link https://opensource.org/licenses/MIT|MIT License}
*/
import MATH_CONST from '../../math/const.js';
import Wrap from '../../math/Wrap.js';
import Angle from './Angle.js';
/**
* Get the angle of the normal of the given line in radians.
*
* @function Phaser.Geom.Line.NormalAngle
* @since 3.0.0
*
* @param {Phaser.Geom.Line} line - The line to calculate the angle of the normal of.
*
* @return {number} The angle of the normal of the line in radians.
*/
var NormalAngle = function (line) {
var angle = Angle(line) - MATH_CONST.TAU;
return Wrap(angle, -Math.PI, Math.PI);
};
export default NormalAngle;