UNPKG

phaser

Version:

A fast, free and fun HTML5 Game Framework for Desktop and Mobile web browsers from the team at Phaser Studio Inc.

26 lines (22 loc) 658 B
/** * @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 Angle = require('./Angle'); /** * Returns the x component of the normal vector of the given line. * * @function Phaser.Geom.Line.NormalX * @since 3.0.0 * * @param {Phaser.Geom.Line} line - The Line object to get the normal value from. * * @return {number} The x component of the normal vector of the line. */ var NormalX = function (line) { return Math.cos(Angle(line) - MATH_CONST.TAU); }; module.exports = NormalX;