arcade-physics
Version:
Use Arcade Physics without Phaser.
30 lines • 1.1 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 Angle_1 = __importDefault(require("./Angle"));
const NormalAngle_1 = __importDefault(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.
*/
const ReflectAngle = (lineA, lineB) => {
return 2 * (0, NormalAngle_1.default)(lineB) - Math.PI - (0, Angle_1.default)(lineA);
};
exports.default = ReflectAngle;
//# sourceMappingURL=ReflectAngle.js.map