Skip to content

Commit 0ee6d16

Browse files
committed
Finished Geom JSDocs
1 parent 11a24cd commit 0ee6d16

15 files changed

Lines changed: 67 additions & 61 deletions

src/geom/line/NormalX.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,14 @@ var MATH_CONST = require('../../math/const');
88
var Angle = require('./Angle');
99

1010
/**
11-
* [description]
11+
* Returns the x component of the normal vector of the given line.
1212
*
1313
* @function Phaser.Geom.Line.NormalX
1414
* @since 3.0.0
1515
*
1616
* @param {Phaser.Geom.Line} line - The Line object to get the normal value from.
1717
*
18-
* @return {number} [description]
18+
* @return {number} The x component of the normal vector of the line.
1919
*/
2020
var NormalX = function (line)
2121
{

src/geom/point/GetCentroid.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,10 @@ var Point = require('./Point');
1515
*
1616
* @generic {Phaser.Geom.Point} O - [out,$return]
1717
*
18-
* @param {Phaser.Geom.Point[]} points - [description]
19-
* @param {Phaser.Geom.Point} [out] - [description]
18+
* @param {Phaser.Types.Math.Vector2Like[]} points - An array of Vector2Like objects to get the geometric center of.
19+
* @param {Phaser.Geom.Point} [out] - A Point object to store the output coordinates in. If not given, a new Point instance is created.
2020
*
21-
* @return {Phaser.Geom.Point} [description]
21+
* @return {Phaser.Geom.Point} A Point object representing the geometric center of the given points.
2222
*/
2323
var GetCentroid = function (points, out)
2424
{

src/geom/point/GetRectangleFromPoints.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,10 @@ var Rectangle = require('../rectangle/Rectangle');
1414
*
1515
* @generic {Phaser.Geom.Rectangle} O - [out,$return]
1616
*
17-
* @param {Phaser.Geom.Point[]} points - [description]
18-
* @param {Phaser.Geom.Rectangle} [out] - [description]
17+
* @param {Phaser.Types.Math.Vector2Like[]} points - An array of Vector2Like objects to get the AABB from.
18+
* @param {Phaser.Geom.Rectangle} [out] - A Rectangle object to store the results in. If not given, a new Rectangle instance is created.
1919
*
20-
* @return {Phaser.Geom.Rectangle} [description]
20+
* @return {Phaser.Geom.Rectangle} A Rectangle object holding the AABB values for the given points.
2121
*/
2222
var GetRectangleFromPoints = function (points, out)
2323
{

src/geom/point/Interpolate.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
var Point = require('./Point');
88

99
/**
10-
* [description]
10+
* Returns the linear interpolation point between the two given points, based on `t`.
1111
*
1212
* @function Phaser.Geom.Point.Interpolate
1313
* @since 3.0.0

src/geom/point/Project.js

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,18 +8,19 @@ var Point = require('./Point');
88
var GetMagnitudeSq = require('./GetMagnitudeSq');
99

1010
/**
11-
* [description]
11+
* Calculates the vector projection of `pointA` onto the nonzero `pointB`. This is the
12+
* orthogonal projection of `pointA` onto a straight line paralle to `pointB`.
1213
*
1314
* @function Phaser.Geom.Point.Project
1415
* @since 3.0.0
1516
*
1617
* @generic {Phaser.Geom.Point} O - [out,$return]
1718
*
18-
* @param {Phaser.Geom.Point} pointA - [description]
19-
* @param {Phaser.Geom.Point} pointB - [description]
20-
* @param {Phaser.Geom.Point} [out] - [description]
19+
* @param {Phaser.Geom.Point} pointA - Point A, to be projected onto Point B.
20+
* @param {Phaser.Geom.Point} pointB - Point B, to have Point A projected upon it.
21+
* @param {Phaser.Geom.Point} [out] - The Point object to store the position in. If not given, a new Point instance is created.
2122
*
22-
* @return {Phaser.Geom.Point} [description]
23+
* @return {Phaser.Geom.Point} A Point object holding the coordinates of the vector projection of `pointA` onto `pointB`.
2324
*/
2425
var Project = function (pointA, pointB, out)
2526
{

src/geom/point/ProjectUnit.js

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,18 +7,19 @@
77
var Point = require('./Point');
88

99
/**
10-
* [description]
10+
* Calculates the vector projection of `pointA` onto the nonzero `pointB`. This is the
11+
* orthogonal projection of `pointA` onto a straight line paralle to `pointB`.
1112
*
1213
* @function Phaser.Geom.Point.ProjectUnit
1314
* @since 3.0.0
1415
*
1516
* @generic {Phaser.Geom.Point} O - [out,$return]
1617
*
17-
* @param {Phaser.Geom.Point} pointA - [description]
18-
* @param {Phaser.Geom.Point} pointB - [description]
19-
* @param {Phaser.Geom.Point} [out] - [description]
18+
* @param {Phaser.Geom.Point} pointA - Point A, to be projected onto Point B. Must be a normalized point with a magnitude of 1.
19+
* @param {Phaser.Geom.Point} pointB - Point B, to have Point A projected upon it.
20+
* @param {Phaser.Geom.Point} [out] - The Point object to store the position in. If not given, a new Point instance is created.
2021
*
21-
* @return {Phaser.Geom.Point} [description]
22+
* @return {Phaser.Geom.Point} A unit Point object holding the coordinates of the vector projection of `pointA` onto `pointB`.
2223
*/
2324
var ProjectUnit = function (pointA, pointB, out)
2425
{

src/geom/polygon/ContainsPoint.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,15 @@
77
var Contains = require('./Contains');
88

99
/**
10-
* [description]
10+
* Checks the given Point again the Polygon to see if the Point lays within its vertices.
1111
*
1212
* @function Phaser.Geom.Polygon.ContainsPoint
1313
* @since 3.0.0
1414
*
15-
* @param {Phaser.Geom.Polygon} polygon - [description]
16-
* @param {Phaser.Geom.Point} point - [description]
15+
* @param {Phaser.Geom.Polygon} polygon - The Polygon to check.
16+
* @param {Phaser.Geom.Point} point - The Point to check if it's within the Polygon.
1717
*
18-
* @return {boolean} [description]
18+
* @return {boolean} `true` if the Point is within the Polygon, otherwise `false`.
1919
*/
2020
var ContainsPoint = function (polygon, point)
2121
{

src/geom/rectangle/GetPoint.js

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,18 +8,22 @@ var Perimeter = require('./Perimeter');
88
var Point = require('../point/Point');
99

1010
/**
11-
* Position is a value between 0 and 1 where 0 = the top-left of the rectangle and 0.5 = the bottom right.
11+
* Calculates the coordinates of a point at a certain `position` on the Rectangle's perimeter.
12+
*
13+
* The `position` is a fraction between 0 and 1 which defines how far into the perimeter the point is.
14+
*
15+
* 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.
1216
*
1317
* @function Phaser.Geom.Rectangle.GetPoint
1418
* @since 3.0.0
1519
*
1620
* @generic {Phaser.Geom.Point} O - [out,$return]
1721
*
18-
* @param {Phaser.Geom.Rectangle} rectangle - [description]
19-
* @param {number} position - [description]
20-
* @param {(Phaser.Geom.Point|object)} [out] - [description]
22+
* @param {Phaser.Geom.Rectangle} rectangle - The Rectangle to get the perimeter point from.
23+
* @param {number} position - The normalized distance into the Rectangle's perimeter to return.
24+
* @param {(Phaser.Geom.Point|object)} [out] - An object to update with the `x` and `y` coordinates of the point.
2125
*
22-
* @return {Phaser.Geom.Point} [description]
26+
* @return {Phaser.Geom.Point} The updated `output` object, or a new Point if no `output` object was given.
2327
*/
2428
var GetPoint = function (rectangle, position, out)
2529
{

src/geom/rectangle/GetSize.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,18 +8,18 @@ var Point = require('../point/Point');
88

99

1010
/**
11-
* The size of the Rectangle object, expressed as a Point object
12-
* with the values of the width and height properties.
11+
* Returns the size of the Rectangle, expressed as a Point object.
12+
* With the value of the `width` as the `x` property and the `height` as the `y` property.
1313
*
1414
* @function Phaser.Geom.Rectangle.GetSize
1515
* @since 3.0.0
1616
*
1717
* @generic {Phaser.Geom.Point} O - [out,$return]
1818
*
19-
* @param {Phaser.Geom.Rectangle} rect - [description]
20-
* @param {(Phaser.Geom.Point|object)} [out] - [description]
19+
* @param {Phaser.Geom.Rectangle} rect - The Rectangle to get the size from.
20+
* @param {(Phaser.Geom.Point|object)} [out] - The Point object to store the size in. If not given, a new Point instance is created.
2121
*
22-
* @return {(Phaser.Geom.Point|object)} [description]
22+
* @return {(Phaser.Geom.Point|object)} A Point object where `x` holds the width and `y` holds the height of the Rectangle.
2323
*/
2424
var GetSize = function (rect, out)
2525
{

src/geom/rectangle/MarchingAnts.js

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,20 +9,20 @@ var Point = require('../point/Point');
99

1010

1111
/**
12-
* Return an array of points from the perimeter of the rectangle
13-
* each spaced out based on the quantity or step required
12+
* Returns an array of points from the perimeter of the Rectangle, where each point is spaced out based
13+
* on either the `step` value, or the `quantity`.
1414
*
1515
* @function Phaser.Geom.Rectangle.MarchingAnts
1616
* @since 3.0.0
1717
*
1818
* @generic {Phaser.Geom.Point[]} O - [out,$return]
1919
*
20-
* @param {Phaser.Geom.Rectangle} rect - [description]
21-
* @param {number} step - [description]
22-
* @param {integer} quantity - [description]
23-
* @param {(array|Phaser.Geom.Point[])} [out] - [description]
20+
* @param {Phaser.Geom.Rectangle} rect - The Rectangle to get the perimeter points from.
21+
* @param {number} [step] - The distance between each point of the perimeter. Set to `null` if you wish to use the `quantity` parameter instead.
22+
* @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.
23+
* @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.
2424
*
25-
* @return {(array|Phaser.Geom.Point[])} [description]
25+
* @return {(array|Phaser.Geom.Point[])} An array containing the perimeter points from the Rectangle.
2626
*/
2727
var MarchingAnts = function (rect, step, quantity, out)
2828
{

0 commit comments

Comments
 (0)