UNPKG

arcade-physics

Version:
34 lines 1.12 kB
"use strict"; /** * @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 Point_1 = __importDefault(require("../point/Point")); /** * Get the midpoint of the given line. * * @function Phaser.Geom.Line.GetMidPoint * @since 3.0.0 * * @generic {Phaser.Geom.Point} O - [out,$return] * * @param {Phaser.Geom.Line} line - The line to get the midpoint of. * @param {(Phaser.Geom.Point|object)} [out] - An optional point object to store the midpoint in. * * @return {(Phaser.Geom.Point|object)} The midpoint of the Line. */ const GetMidPoint = (line, out) => { if (out === undefined) { out = new Point_1.default(); } out.x = (line.x1 + line.x2) / 2; out.y = (line.y1 + line.y2) / 2; return out; }; exports.default = GetMidPoint; //# sourceMappingURL=GetMidPoint.js.map