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 (24 loc) • 744 B
JavaScript
/**
* @author Richard Davey <rich@phaser.io>
* @copyright 2013-2025 Phaser Studio Inc.
* @license {@link https://opensource.org/licenses/MIT|MIT License}
*/
var MATH_CONST = require('../../math/const');
var Wrap = require('../../math/Wrap');
var Angle = require('./Angle');
/**
* 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);
};
module.exports = NormalAngle;