Skip to content

Commit 17341d3

Browse files
authored
Merge pull request phaserjs#3614 from Fabadiculous/docs
Docs for DegToRad, RadToDeg, Rotate, Within, RoundAwayFromZero and IsEven
2 parents cf8e2cf + 78d1c56 commit 17341d3

7 files changed

Lines changed: 62 additions & 62 deletions

File tree

src/math/DegToRad.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,14 @@
77
var CONST = require('./const');
88

99
/**
10-
* [description]
10+
* Convert the given angle from degrees, to the equivalent angle in radians.
1111
*
1212
* @function Phaser.Math.DegToRad
1313
* @since 3.0.0
1414
*
15-
* @param {integer} degrees - [description]
15+
* @param {integer} degrees - The angle (in degrees) to convert to radians.
1616
*
17-
* @return {float} [description]
17+
* @return {float} The given angle converted to radians.
1818
*/
1919
var DegToRad = function (degrees)
2020
{

src/math/IsEven.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,14 @@
55
*/
66

77
/**
8-
* [description]
8+
* Check if a given value is an even number.
99
*
1010
* @function Phaser.Math.IsEven
1111
* @since 3.0.0
1212
*
13-
* @param {number} value - [description]
13+
* @param {number} value - The number to perform the check with.
1414
*
15-
* @return {boolean} [description]
15+
* @return {boolean} Whether the number is even or not.
1616
*/
1717
var IsEven = function (value)
1818
{

src/math/RadToDeg.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,14 @@
77
var CONST = require('./const');
88

99
/**
10-
* [description]
10+
* Convert the given angle in radians, to the equivalent angle in degrees.
1111
*
1212
* @function Phaser.Math.RadToDeg
1313
* @since 3.0.0
1414
*
15-
* @param {float} radians - [description]
15+
* @param {float} radians - The angle in radians to convert ot degrees.
1616
*
17-
* @return {integer} [description]
17+
* @return {integer} The given angle converted to degrees.
1818
*/
1919
var RadToDeg = function (radians)
2020
{

src/math/Rotate.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,15 @@
55
*/
66

77
/**
8-
* [description]
8+
* Rotate a given point by a given angle around the origin (0, 0), in an anti-clockwise direction.
99
*
1010
* @function Phaser.Math.Rotate
1111
* @since 3.0.0
1212
*
13-
* @param {(Phaser.Geom.Point|object)} point - [description]
14-
* @param {number} angle - [description]
13+
* @param {(Phaser.Geom.Point|object)} point - The point to be rotated.
14+
* @param {number} angle - The angle to be rotated by in an anticlockwise direction.
1515
*
16-
* @return {Phaser.Geom.Point} [description]
16+
* @return {Phaser.Geom.Point} The given point, rotated by the given angle in an anticlockwise direction.
1717
*/
1818
var Rotate = function (point, angle)
1919
{

src/math/RoundAwayFromZero.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,14 @@
55
*/
66

77
/**
8-
* [description]
8+
* Round a given number so it is further away from zero. That is, positive numbers are rounded up, and negative numbers are rounded down.
99
*
1010
* @function Phaser.Math.RoundAwayFromZero
1111
* @since 3.0.0
1212
*
13-
* @param {number} value - [description]
13+
* @param {number} value - The number to round.
1414
*
15-
* @return {number} [description]
15+
* @return {number} The rounded number, rounded away from zero.
1616
*/
1717
var RoundAwayFromZero = function (value)
1818
{

src/math/Vector2.js

Lines changed: 44 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -18,15 +18,15 @@ var Class = require('../utils/Class');
1818

1919
/**
2020
* @classdesc
21-
* [description]
21+
* A representation of a vector in 2D space.
2222
*
2323
* @class Vector2
2424
* @memberOf Phaser.Math
2525
* @constructor
2626
* @since 3.0.0
2727
*
28-
* @param {number} [x] - [description]
29-
* @param {number} [y] - [description]
28+
* @param {number} [x] - The x component of this Vector.
29+
* @param {number} [y] - The y component of this Vector.
3030
*/
3131
var Vector2 = new Class({
3232

@@ -69,7 +69,7 @@ var Vector2 = new Class({
6969
},
7070

7171
/**
72-
* [description]
72+
* Make a clone of this Vector2.
7373
*
7474
* @method Phaser.Math.Vector2#clone
7575
* @since 3.0.0
@@ -82,12 +82,12 @@ var Vector2 = new Class({
8282
},
8383

8484
/**
85-
* [description]
85+
* Copy the components of a given vector, into this Vector.
8686
*
8787
* @method Phaser.Math.Vector2#copy
8888
* @since 3.0.0
8989
*
90-
* @param {Phaser.Math.Vector2} src - [description]
90+
* @param {Phaser.Math.Vector2} src - The Vector to copy the components from.
9191
*
9292
* @return {Phaser.Math.Vector2} This Vector2.
9393
*/
@@ -100,12 +100,12 @@ var Vector2 = new Class({
100100
},
101101

102102
/**
103-
* [description]
103+
* Set the component values of this Vector from a given Vector2Like object.
104104
*
105105
* @method Phaser.Math.Vector2#setFromObject
106106
* @since 3.0.0
107107
*
108-
* @param {Vector2Like} obj - [description]
108+
* @param {Vector2Like} obj - The object containing the component values to set for this Vector.
109109
*
110110
* @return {Phaser.Math.Vector2} This Vector2.
111111
*/
@@ -118,13 +118,13 @@ var Vector2 = new Class({
118118
},
119119

120120
/**
121-
* [description]
121+
* Set the x and y components of the this Vector to the given x and y values.
122122
*
123123
* @method Phaser.Math.Vector2#set
124124
* @since 3.0.0
125125
*
126-
* @param {number} x - [description]
127-
* @param {number} [y=x] - [description]
126+
* @param {number} x - The x value to set for this Vector.
127+
* @param {number} [y=x] - The y value to set for this Vector.
128128
*
129129
* @return {Phaser.Math.Vector2} This Vector2.
130130
*/
@@ -144,8 +144,8 @@ var Vector2 = new Class({
144144
* @method Phaser.Math.Vector2#setTo
145145
* @since 3.4.0
146146
*
147-
* @param {number} x - [description]
148-
* @param {number} [y=x] - [description]
147+
* @param {number} x - The x value to set for this Vector.
148+
* @param {number} [y=x] - The y value to set for this Vector.
149149
*
150150
* @return {Phaser.Math.Vector2} This Vector2.
151151
*/
@@ -176,27 +176,27 @@ var Vector2 = new Class({
176176
},
177177

178178
/**
179-
* [description]
179+
* Check if this Vector is equal to a given Vector.
180180
*
181181
* @method Phaser.Math.Vector2#equals
182182
* @since 3.0.0
183183
*
184-
* @param {Phaser.Math.Vector2} v - [description]
184+
* @param {Phaser.Math.Vector2} v - The vector to compare with this Vector.
185185
*
186-
* @return {boolean} [description]
186+
* @return {boolean} Whether the given Vector is equal to this Vector.
187187
*/
188188
equals: function (v)
189189
{
190190
return ((this.x === v.x) && (this.y === v.y));
191191
},
192192

193193
/**
194-
* [description]
194+
* Calculate the angle between this Vector and the positive x-axis, in radians.
195195
*
196196
* @method Phaser.Math.Vector2#angle
197197
* @since 3.0.0
198198
*
199-
* @return {number} [description]
199+
* @return {number} The angle between this Vector, and the positive x-axis, given in radians.
200200
*/
201201
angle: function ()
202202
{
@@ -213,12 +213,12 @@ var Vector2 = new Class({
213213
},
214214

215215
/**
216-
* [description]
216+
* Add a given Vector to this Vector. Addition is element-wise.
217217
*
218218
* @method Phaser.Math.Vector2#add
219219
* @since 3.0.0
220220
*
221-
* @param {Phaser.Math.Vector2} src - [description]
221+
* @param {Phaser.Math.Vector2} src - The Vector to add to this Vector.
222222
*
223223
* @return {Phaser.Math.Vector2} This Vector2.
224224
*/
@@ -231,12 +231,12 @@ var Vector2 = new Class({
231231
},
232232

233233
/**
234-
* [description]
234+
* Subtract the given Vector from this Vector. Subtraction is element-wise.
235235
*
236236
* @method Phaser.Math.Vector2#subtract
237237
* @since 3.0.0
238238
*
239-
* @param {Phaser.Math.Vector2} src - [description]
239+
* @param {Phaser.Math.Vector2} src - The Vector to subtract from this Vector.
240240
*
241241
* @return {Phaser.Math.Vector2} This Vector2.
242242
*/
@@ -249,12 +249,12 @@ var Vector2 = new Class({
249249
},
250250

251251
/**
252-
* [description]
252+
* Perform an element-wise multiplication between this Vector and the given Vector.
253253
*
254254
* @method Phaser.Math.Vector2#multiply
255255
* @since 3.0.0
256256
*
257-
* @param {Phaser.Math.Vector2} src - [description]
257+
* @param {Phaser.Math.Vector2} src - The Vector to multiply this Vector by.
258258
*
259259
* @return {Phaser.Math.Vector2} This Vector2.
260260
*/
@@ -267,12 +267,12 @@ var Vector2 = new Class({
267267
},
268268

269269
/**
270-
* [description]
270+
* Scale this Vector by the given value.
271271
*
272272
* @method Phaser.Math.Vector2#scale
273273
* @since 3.0.0
274274
*
275-
* @param {number} value - [description]
275+
* @param {number} value - The value to scale this Vector by.
276276
*
277277
* @return {Phaser.Math.Vector2} This Vector2.
278278
*/
@@ -293,12 +293,12 @@ var Vector2 = new Class({
293293
},
294294

295295
/**
296-
* [description]
296+
* Perform an element-wise division between this Vector and the given Vector. This Vector is divided by the given Vector.
297297
*
298298
* @method Phaser.Math.Vector2#divide
299299
* @since 3.0.0
300300
*
301-
* @param {Phaser.Math.Vector2} src - [description]
301+
* @param {Phaser.Math.Vector2} src - The Vector to divide this Vector by.
302302
*
303303
* @return {Phaser.Math.Vector2} This Vector2.
304304
*/
@@ -311,7 +311,7 @@ var Vector2 = new Class({
311311
},
312312

313313
/**
314-
* [description]
314+
* Negate the x and y components of this Vector.
315315
*
316316
* @method Phaser.Math.Vector2#negate
317317
* @since 3.0.0
@@ -327,14 +327,14 @@ var Vector2 = new Class({
327327
},
328328

329329
/**
330-
* [description]
330+
* Calculate the distance between this Vector, and the given Vector.
331331
*
332332
* @method Phaser.Math.Vector2#distance
333333
* @since 3.0.0
334334
*
335-
* @param {Phaser.Math.Vector2} src - [description]
335+
* @param {Phaser.Math.Vector2} src - The Vector to calculate the distance to.
336336
*
337-
* @return {number} [description]
337+
* @return {number} The distance to the given Vector from this Vector.
338338
*/
339339
distance: function (src)
340340
{
@@ -345,14 +345,14 @@ var Vector2 = new Class({
345345
},
346346

347347
/**
348-
* [description]
348+
* The distance between this Vector, and the given Vector, squared.
349349
*
350350
* @method Phaser.Math.Vector2#distanceSq
351351
* @since 3.0.0
352352
*
353-
* @param {Phaser.Math.Vector2} src - [description]
353+
* @param {Phaser.Math.Vector2} src - The Vector to calculate the distance to.
354354
*
355-
* @return {number} [description]
355+
* @return {number} The distance to this Vector and the given Vector, squared.
356356
*/
357357
distanceSq: function (src)
358358
{
@@ -363,12 +363,12 @@ var Vector2 = new Class({
363363
},
364364

365365
/**
366-
* [description]
366+
* The length (or magnitude) of this Vector.
367367
*
368368
* @method Phaser.Math.Vector2#length
369369
* @since 3.0.0
370370
*
371-
* @return {number} [description]
371+
* @return {number} The length of this Vector.
372372
*/
373373
length: function ()
374374
{
@@ -379,12 +379,12 @@ var Vector2 = new Class({
379379
},
380380

381381
/**
382-
* [description]
382+
* Calculate the length of this Vector squared.
383383
*
384384
* @method Phaser.Math.Vector2#lengthSq
385385
* @since 3.0.0
386386
*
387-
* @return {number} [description]
387+
* @return {number} The length of this Vector, squared.
388388
*/
389389
lengthSq: function ()
390390
{
@@ -395,7 +395,7 @@ var Vector2 = new Class({
395395
},
396396

397397
/**
398-
* [description]
398+
* Normalise this Vector, that is, make it a unit length vector (magnitude of 1) in the same direction.
399399
*
400400
* @method Phaser.Math.Vector2#normalize
401401
* @since 3.0.0
@@ -440,14 +440,14 @@ var Vector2 = new Class({
440440
},
441441

442442
/**
443-
* [description]
443+
* Perform a dot product between this Vector and the given Vector
444444
*
445445
* @method Phaser.Math.Vector2#dot
446446
* @since 3.0.0
447447
*
448-
* @param {Phaser.Math.Vector2} src - [description]
448+
* @param {Phaser.Math.Vector2} src - The Vector2 to dot product with this Vector2.
449449
*
450-
* @return {number} [description]
450+
* @return {number} The result of the dot product
451451
*/
452452
dot: function (src)
453453
{
@@ -538,7 +538,7 @@ var Vector2 = new Class({
538538
},
539539

540540
/**
541-
* [description]
541+
* Make this Vector the zero vector (0, 0).
542542
*
543543
* @method Phaser.Math.Vector2#reset
544544
* @since 3.0.0

0 commit comments

Comments
 (0)