diff --git a/src/geom/line/NormalX.js b/src/geom/line/NormalX.js index 8c3de902c..8cb0a3d84 100644 --- a/src/geom/line/NormalX.js +++ b/src/geom/line/NormalX.js @@ -8,14 +8,14 @@ var MATH_CONST = require('../../math/const'); var Angle = require('./Angle'); /** - * [description] + * 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} [description] + * @return {number} The x component of the normal vector of the line. */ var NormalX = function (line) { diff --git a/src/geom/point/GetCentroid.js b/src/geom/point/GetCentroid.js index db460048e..c081fe4f8 100644 --- a/src/geom/point/GetCentroid.js +++ b/src/geom/point/GetCentroid.js @@ -15,10 +15,10 @@ var Point = require('./Point'); * * @generic {Phaser.Geom.Point} O - [out,$return] * - * @param {Phaser.Geom.Point[]} points - [description] - * @param {Phaser.Geom.Point} [out] - [description] + * @param {Phaser.Types.Math.Vector2Like[]} points - An array of Vector2Like objects to get the geometric center of. + * @param {Phaser.Geom.Point} [out] - A Point object to store the output coordinates in. If not given, a new Point instance is created. * - * @return {Phaser.Geom.Point} [description] + * @return {Phaser.Geom.Point} A Point object representing the geometric center of the given points. */ var GetCentroid = function (points, out) { diff --git a/src/geom/point/GetRectangleFromPoints.js b/src/geom/point/GetRectangleFromPoints.js index bea998048..3927bbadf 100644 --- a/src/geom/point/GetRectangleFromPoints.js +++ b/src/geom/point/GetRectangleFromPoints.js @@ -14,10 +14,10 @@ var Rectangle = require('../rectangle/Rectangle'); * * @generic {Phaser.Geom.Rectangle} O - [out,$return] * - * @param {Phaser.Geom.Point[]} points - [description] - * @param {Phaser.Geom.Rectangle} [out] - [description] + * @param {Phaser.Types.Math.Vector2Like[]} points - An array of Vector2Like objects to get the AABB from. + * @param {Phaser.Geom.Rectangle} [out] - A Rectangle object to store the results in. If not given, a new Rectangle instance is created. * - * @return {Phaser.Geom.Rectangle} [description] + * @return {Phaser.Geom.Rectangle} A Rectangle object holding the AABB values for the given points. */ var GetRectangleFromPoints = function (points, out) { diff --git a/src/geom/point/Interpolate.js b/src/geom/point/Interpolate.js index 2048868a8..fcd4e1a90 100644 --- a/src/geom/point/Interpolate.js +++ b/src/geom/point/Interpolate.js @@ -7,7 +7,7 @@ var Point = require('./Point'); /** - * [description] + * Returns the linear interpolation point between the two given points, based on `t`. * * @function Phaser.Geom.Point.Interpolate * @since 3.0.0 diff --git a/src/geom/point/Project.js b/src/geom/point/Project.js index 7446f2be9..219b80f6c 100644 --- a/src/geom/point/Project.js +++ b/src/geom/point/Project.js @@ -8,18 +8,19 @@ var Point = require('./Point'); var GetMagnitudeSq = require('./GetMagnitudeSq'); /** - * [description] + * Calculates the vector projection of `pointA` onto the nonzero `pointB`. This is the + * orthogonal projection of `pointA` onto a straight line paralle to `pointB`. * * @function Phaser.Geom.Point.Project * @since 3.0.0 * * @generic {Phaser.Geom.Point} O - [out,$return] * - * @param {Phaser.Geom.Point} pointA - [description] - * @param {Phaser.Geom.Point} pointB - [description] - * @param {Phaser.Geom.Point} [out] - [description] + * @param {Phaser.Geom.Point} pointA - Point A, to be projected onto Point B. + * @param {Phaser.Geom.Point} pointB - Point B, to have Point A projected upon it. + * @param {Phaser.Geom.Point} [out] - The Point object to store the position in. If not given, a new Point instance is created. * - * @return {Phaser.Geom.Point} [description] + * @return {Phaser.Geom.Point} A Point object holding the coordinates of the vector projection of `pointA` onto `pointB`. */ var Project = function (pointA, pointB, out) { diff --git a/src/geom/point/ProjectUnit.js b/src/geom/point/ProjectUnit.js index e8a013820..236d2a2db 100644 --- a/src/geom/point/ProjectUnit.js +++ b/src/geom/point/ProjectUnit.js @@ -7,18 +7,19 @@ var Point = require('./Point'); /** - * [description] + * Calculates the vector projection of `pointA` onto the nonzero `pointB`. This is the + * orthogonal projection of `pointA` onto a straight line paralle to `pointB`. * * @function Phaser.Geom.Point.ProjectUnit * @since 3.0.0 * * @generic {Phaser.Geom.Point} O - [out,$return] * - * @param {Phaser.Geom.Point} pointA - [description] - * @param {Phaser.Geom.Point} pointB - [description] - * @param {Phaser.Geom.Point} [out] - [description] + * @param {Phaser.Geom.Point} pointA - Point A, to be projected onto Point B. Must be a normalized point with a magnitude of 1. + * @param {Phaser.Geom.Point} pointB - Point B, to have Point A projected upon it. + * @param {Phaser.Geom.Point} [out] - The Point object to store the position in. If not given, a new Point instance is created. * - * @return {Phaser.Geom.Point} [description] + * @return {Phaser.Geom.Point} A unit Point object holding the coordinates of the vector projection of `pointA` onto `pointB`. */ var ProjectUnit = function (pointA, pointB, out) { diff --git a/src/geom/polygon/ContainsPoint.js b/src/geom/polygon/ContainsPoint.js index ce23aa20c..09e52a7c2 100644 --- a/src/geom/polygon/ContainsPoint.js +++ b/src/geom/polygon/ContainsPoint.js @@ -7,15 +7,15 @@ var Contains = require('./Contains'); /** - * [description] + * Checks the given Point again the Polygon to see if the Point lays within its vertices. * * @function Phaser.Geom.Polygon.ContainsPoint * @since 3.0.0 * - * @param {Phaser.Geom.Polygon} polygon - [description] - * @param {Phaser.Geom.Point} point - [description] + * @param {Phaser.Geom.Polygon} polygon - The Polygon to check. + * @param {Phaser.Geom.Point} point - The Point to check if it's within the Polygon. * - * @return {boolean} [description] + * @return {boolean} `true` if the Point is within the Polygon, otherwise `false`. */ var ContainsPoint = function (polygon, point) { diff --git a/src/geom/rectangle/GetPoint.js b/src/geom/rectangle/GetPoint.js index af659fe52..3a4f4dfcf 100644 --- a/src/geom/rectangle/GetPoint.js +++ b/src/geom/rectangle/GetPoint.js @@ -8,18 +8,22 @@ var Perimeter = require('./Perimeter'); var Point = require('../point/Point'); /** - * Position is a value between 0 and 1 where 0 = the top-left of the rectangle and 0.5 = the bottom right. + * Calculates the coordinates of a point at a certain `position` on the Rectangle's perimeter. + * + * The `position` is a fraction between 0 and 1 which defines how far into the perimeter the point is. + * + * A value of 0 or 1 returns the point at the top left corner of the rectangle, while a value of 0.5 returns the point at the bottom right corner of the rectangle. Values between 0 and 0.5 are on the top or the right side and values between 0.5 and 1 are on the bottom or the left side. * * @function Phaser.Geom.Rectangle.GetPoint * @since 3.0.0 * * @generic {Phaser.Geom.Point} O - [out,$return] * - * @param {Phaser.Geom.Rectangle} rectangle - [description] - * @param {number} position - [description] - * @param {(Phaser.Geom.Point|object)} [out] - [description] + * @param {Phaser.Geom.Rectangle} rectangle - The Rectangle to get the perimeter point from. + * @param {number} position - The normalized distance into the Rectangle's perimeter to return. + * @param {(Phaser.Geom.Point|object)} [out] - An object to update with the `x` and `y` coordinates of the point. * - * @return {Phaser.Geom.Point} [description] + * @return {Phaser.Geom.Point} The updated `output` object, or a new Point if no `output` object was given. */ var GetPoint = function (rectangle, position, out) { diff --git a/src/geom/rectangle/GetSize.js b/src/geom/rectangle/GetSize.js index bdfaa6cc4..d8f8f5fd7 100644 --- a/src/geom/rectangle/GetSize.js +++ b/src/geom/rectangle/GetSize.js @@ -8,18 +8,18 @@ var Point = require('../point/Point'); /** - * The size of the Rectangle object, expressed as a Point object - * with the values of the width and height properties. + * Returns the size of the Rectangle, expressed as a Point object. + * With the value of the `width` as the `x` property and the `height` as the `y` property. * * @function Phaser.Geom.Rectangle.GetSize * @since 3.0.0 * * @generic {Phaser.Geom.Point} O - [out,$return] * - * @param {Phaser.Geom.Rectangle} rect - [description] - * @param {(Phaser.Geom.Point|object)} [out] - [description] + * @param {Phaser.Geom.Rectangle} rect - The Rectangle to get the size from. + * @param {(Phaser.Geom.Point|object)} [out] - The Point object to store the size in. If not given, a new Point instance is created. * - * @return {(Phaser.Geom.Point|object)} [description] + * @return {(Phaser.Geom.Point|object)} A Point object where `x` holds the width and `y` holds the height of the Rectangle. */ var GetSize = function (rect, out) { diff --git a/src/geom/rectangle/MarchingAnts.js b/src/geom/rectangle/MarchingAnts.js index bac6f1f97..c0c452cea 100644 --- a/src/geom/rectangle/MarchingAnts.js +++ b/src/geom/rectangle/MarchingAnts.js @@ -9,20 +9,20 @@ var Point = require('../point/Point'); /** - * Return an array of points from the perimeter of the rectangle - * each spaced out based on the quantity or step required + * Returns an array of points from the perimeter of the Rectangle, where each point is spaced out based + * on either the `step` value, or the `quantity`. * * @function Phaser.Geom.Rectangle.MarchingAnts * @since 3.0.0 * * @generic {Phaser.Geom.Point[]} O - [out,$return] * - * @param {Phaser.Geom.Rectangle} rect - [description] - * @param {number} step - [description] - * @param {integer} quantity - [description] - * @param {(array|Phaser.Geom.Point[])} [out] - [description] + * @param {Phaser.Geom.Rectangle} rect - The Rectangle to get the perimeter points from. + * @param {number} [step] - The distance between each point of the perimeter. Set to `null` if you wish to use the `quantity` parameter instead. + * @param {integer} [quantity] - The total number of points to return. The step is then calculated based on the length of the Rectangle, divided by this value. + * @param {(array|Phaser.Geom.Point[])} [out] - An array in which the perimeter points will be stored. If not given, a new array instance is created. * - * @return {(array|Phaser.Geom.Point[])} [description] + * @return {(array|Phaser.Geom.Point[])} An array containing the perimeter points from the Rectangle. */ var MarchingAnts = function (rect, step, quantity, out) { diff --git a/src/geom/rectangle/PerimeterPoint.js b/src/geom/rectangle/PerimeterPoint.js index 48c913bfc..e76b79702 100644 --- a/src/geom/rectangle/PerimeterPoint.js +++ b/src/geom/rectangle/PerimeterPoint.js @@ -8,18 +8,18 @@ var Point = require('../point/Point'); var DegToRad = require('../../math/DegToRad'); /** - * [description] + * Returns a Point from the perimeter of a Rectangle based on the given angle. * * @function Phaser.Geom.Rectangle.PerimeterPoint * @since 3.0.0 * * @generic {Phaser.Geom.Point} O - [out,$return] * - * @param {Phaser.Geom.Rectangle} rectangle - [description] - * @param {integer} angle - [description] - * @param {Phaser.Geom.Point} [out] - [description] + * @param {Phaser.Geom.Rectangle} rectangle - The Rectangle to get the perimeter point from. + * @param {integer} angle - The angle of the point, in degrees. + * @param {Phaser.Geom.Point} [out] - The Point object to store the position in. If not given, a new Point instance is created. * - * @return {Phaser.Geom.Point} [description] + * @return {Phaser.Geom.Point} A Point object holding the coordinates of the Rectangle perimeter. */ var PerimeterPoint = function (rectangle, angle, out) { diff --git a/src/geom/triangle/BuildFromPolygon.js b/src/geom/triangle/BuildFromPolygon.js index e0c46e09f..f8a1096fc 100644 --- a/src/geom/triangle/BuildFromPolygon.js +++ b/src/geom/triangle/BuildFromPolygon.js @@ -8,7 +8,8 @@ var EarCut = require('../polygon/Earcut'); var Triangle = require('./Triangle'); /** - * [description] + * Takes an array of vertex coordinates, and optionally an array of hole indices, then returns an array + * of Triangle instances, where the given vertices have been decomposed into a series of triangles. * * @function Phaser.Geom.Triangle.BuildFromPolygon * @since 3.0.0 @@ -17,11 +18,11 @@ var Triangle = require('./Triangle'); * * @param {array} data - A flat array of vertex coordinates like [x0,y0, x1,y1, x2,y2, ...] * @param {array} [holes=null] - An array of hole indices if any (e.g. [5, 8] for a 12-vertex input would mean one hole with vertices 5–7 and another with 8–11). - * @param {number} [scaleX=1] - [description] - * @param {number} [scaleY=1] - [description] - * @param {(array|Phaser.Geom.Triangle[])} [out] - [description] + * @param {number} [scaleX=1] - Horizontal scale factor to multiply the resulting points by. + * @param {number} [scaleY=1] - Vertical scale factor to multiply the resulting points by. + * @param {(array|Phaser.Geom.Triangle[])} [out] - An array to store the resulting Triangle instances in. If not provided, a new array is created. * - * @return {(array|Phaser.Geom.Triangle[])} [description] + * @return {(array|Phaser.Geom.Triangle[])} An array of Triangle instances, where each triangle is based on the decomposed vertices data. */ var BuildFromPolygon = function (data, holes, scaleX, scaleY, out) { diff --git a/src/geom/triangle/CircumCenter.js b/src/geom/triangle/CircumCenter.js index cad696ed0..a8bae4ffa 100644 --- a/src/geom/triangle/CircumCenter.js +++ b/src/geom/triangle/CircumCenter.js @@ -39,10 +39,10 @@ function det (m00, m01, m10, m11) * * @generic {Phaser.Math.Vector2} O - [out,$return] * - * @param {Phaser.Geom.Triangle} triangle - [description] - * @param {Phaser.Math.Vector2} [out] - [description] + * @param {Phaser.Geom.Triangle} triangle - The Triangle to get the circumcenter of. + * @param {Phaser.Math.Vector2} [out] - The Vector2 object to store the position in. If not given, a new Vector2 instance is created. * - * @return {Phaser.Math.Vector2} [description] + * @return {Phaser.Math.Vector2} A Vector2 object holding the coordinates of the circumcenter of the Triangle. */ var CircumCenter = function (triangle, out) { diff --git a/src/geom/triangle/Perimeter.js b/src/geom/triangle/Perimeter.js index 6bf7e62b3..65cb3b32e 100644 --- a/src/geom/triangle/Perimeter.js +++ b/src/geom/triangle/Perimeter.js @@ -6,17 +6,16 @@ var Length = require('../line/Length'); -// The 2D area of a triangle. The area value is always non-negative. - /** * Gets the length of the perimeter of the given triangle. + * Calculated by adding together the length of each of the three sides. * * @function Phaser.Geom.Triangle.Perimeter * @since 3.0.0 * - * @param {Phaser.Geom.Triangle} triangle - [description] + * @param {Phaser.Geom.Triangle} triangle - The Triangle to get the length from. * - * @return {number} [description] + * @return {number} The length of the Triangle. */ var Perimeter = function (triangle) { diff --git a/src/geom/triangle/Random.js b/src/geom/triangle/Random.js index 9796e9175..92687c15c 100644 --- a/src/geom/triangle/Random.js +++ b/src/geom/triangle/Random.js @@ -7,17 +7,17 @@ var Point = require('../point/Point'); /** - * [description] + * Returns a random Point from within the area of the given Triangle. * * @function Phaser.Geom.Triangle.Random * @since 3.0.0 * * @generic {Phaser.Geom.Point} O - [out,$return] * - * @param {Phaser.Geom.Triangle} triangle - [description] - * @param {Phaser.Geom.Point} [out] - [description] + * @param {Phaser.Geom.Triangle} triangle - The Triangle to get a random point from. + * @param {Phaser.Geom.Point} [out] - The Point object to store the position in. If not given, a new Point instance is created. * - * @return {Phaser.Geom.Point} [description] + * @return {Phaser.Geom.Point} A Point object holding the coordinates of a random position within the Triangle. */ var Random = function (triangle, out) {