UNPKG

arcade-physics

Version:
39 lines 1.86 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 CircumferencePoint_1 = __importDefault(require("./CircumferencePoint")); const FromPercent_1 = __importDefault(require("../../math/FromPercent")); const const_1 = __importDefault(require("../../math/const")); const Point_1 = __importDefault(require("../point/Point")); /** * Returns a Point object containing the coordinates of a point on the circumference of the Ellipse * based on the given angle normalized to the range 0 to 1. I.e. a value of 0.5 will give the point * at 180 degrees around the circle. * * @function Phaser.Geom.Ellipse.GetPoint * @since 3.0.0 * * @generic {Phaser.Geom.Point} O - [out,$return] * * @param {Phaser.Geom.Ellipse} ellipse - The Ellipse to get the circumference point on. * @param {number} position - A value between 0 and 1, where 0 equals 0 degrees, 0.5 equals 180 degrees and 1 equals 360 around the ellipse. * @param {(Phaser.Geom.Point|object)} [out] - An object to store the return values in. If not given a Point object will be created. * * @return {(Phaser.Geom.Point|object)} A Point, or point-like object, containing the coordinates of the point around the ellipse. */ const GetPoint = (ellipse, position, out) => { if (out === undefined) { out = new Point_1.default(); } const angle = (0, FromPercent_1.default)(position, 0, const_1.default.PI2); return (0, CircumferencePoint_1.default)(ellipse, angle, out); }; exports.default = GetPoint; //# sourceMappingURL=GetPoint.js.map