arcade-physics
Version:
Use Arcade Physics without Phaser.
29 lines • 1.08 kB
JavaScript
;
/**
* @author Richard Davey <rich@photonstorm.com>
* @copyright 2020 Photon Storm Ltd.
* @license {@link https://opensource.org/licenses/MIT|MIT License}
*/
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const const_1 = __importDefault(require("../../math/const"));
const Wrap_1 = __importDefault(require("../../math/Wrap"));
const Angle_1 = __importDefault(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.
*/
const NormalAngle = line => {
const angle = (0, Angle_1.default)(line) - const_1.default.TAU;
return (0, Wrap_1.default)(angle, -Math.PI, Math.PI);
};
exports.default = NormalAngle;
//# sourceMappingURL=NormalAngle.js.map