Skip to content

Commit 303f09b

Browse files
committed
Final JSDocs
1 parent 1d0b5cc commit 303f09b

1 file changed

Lines changed: 85 additions & 6 deletions

File tree

src/geom/mesh/Face.js

Lines changed: 85 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,9 @@ function GetLength (x1, y1, x2, y2)
2727
* @constructor
2828
* @since 3.50.0
2929
*
30-
* @param {Phaser.GameObjects.Vertex} vertex1 - The first vertex of the Face.
31-
* @param {Phaser.GameObjects.Vertex} vertex2 - The second vertex of the Face.
32-
* @param {Phaser.GameObjects.Vertex} vertex3 - The third vertex of the Face.
30+
* @param {Phaser.Geom.Mesh.Vertex} vertex1 - The first vertex of the Face.
31+
* @param {Phaser.Geom.Mesh.Vertex} vertex2 - The second vertex of the Face.
32+
* @param {Phaser.Geom.Mesh.Vertex} vertex3 - The third vertex of the Face.
3333
*/
3434
var Face = new Class({
3535

@@ -41,7 +41,7 @@ var Face = new Class({
4141
* The first vertex in this Face.
4242
*
4343
* @name Phaser.Geom.Mesh.Face#vertex1
44-
* @type {Phaser.GameObjects.Vertex}
44+
* @type {Phaser.Geom.Mesh.Vertex}
4545
* @since 3.50.0
4646
*/
4747
this.vertex1 = vertex1;
@@ -50,7 +50,7 @@ var Face = new Class({
5050
* The second vertex in this Face.
5151
*
5252
* @name Phaser.Geom.Mesh.Face#vertex2
53-
* @type {Phaser.GameObjects.Vertex}
53+
* @type {Phaser.Geom.Mesh.Vertex}
5454
* @since 3.50.0
5555
*/
5656
this.vertex2 = vertex2;
@@ -59,7 +59,7 @@ var Face = new Class({
5959
* The third vertex in this Face.
6060
*
6161
* @name Phaser.Geom.Mesh.Face#vertex3
62-
* @type {Phaser.GameObjects.Vertex}
62+
* @type {Phaser.Geom.Mesh.Vertex}
6363
* @since 3.50.0
6464
*/
6565
this.vertex3 = vertex3;
@@ -75,6 +75,14 @@ var Face = new Class({
7575
this._inCenter = new Vector2();
7676
},
7777

78+
/**
79+
* Gets the In Center of this Face.
80+
*
81+
* @method Phaser.Geom.Mesh.Face#getInCenter
82+
* @since 3.0.0
83+
*
84+
* @return {Phaser.Math.Vector2} A Vector2 instance with the In Center set in it.
85+
*/
7886
getInCenter: function ()
7987
{
8088
var v1 = this.vertex1;
@@ -93,6 +101,17 @@ var Face = new Class({
93101
);
94102
},
95103

104+
/**
105+
* Translate this Face using the given values.
106+
*
107+
* @method Phaser.Geom.Mesh.Face#translate
108+
* @since 3.50.0
109+
*
110+
* @param {number} x - The x component.
111+
* @param {number} y - The y component.
112+
*
113+
* @return {Phaser.Geom.Mesh.Face} This Face instance.
114+
*/
96115
translate: function (x, y)
97116
{
98117
if (y === undefined) { y = 0; }
@@ -108,6 +127,18 @@ var Face = new Class({
108127
return this;
109128
},
110129

130+
/**
131+
* Rotates the vertices in this Face around an optional center point.
132+
*
133+
* @method Phaser.Geom.Mesh.Face#rotate
134+
* @since 3.50.0
135+
*
136+
* @param {number} angle - The angle of ratation, in radians.
137+
* @param {number} [cx] - Optional center x coordinate to rotate around.
138+
* @param {number} [cy] - Optional center y coordinate to rotate around.
139+
*
140+
* @return {Phaser.Geom.Mesh.Face} This Face instance.
141+
*/
111142
rotate: function (angle, cx, cy)
112143
{
113144
var x;
@@ -147,6 +178,18 @@ var Face = new Class({
147178
return this;
148179
},
149180

181+
/**
182+
* Return `true` if this Face intersects with the given coordinates.
183+
*
184+
* @method Phaser.Geom.Mesh.Face#contains
185+
* @since 3.50.0
186+
*
187+
* @param {number} x - The x position to check against.
188+
* @param {number} y - The y position to check against.
189+
* @param {Phaser.Math.Matrix4} [calcMatrix] - Optional transform matrix to apply the vertices through.
190+
*
191+
* @return {boolean} `true` if the position intersects with this Face, otherwise `false`.
192+
*/
150193
contains: function (x, y, calcMatrix)
151194
{
152195
var v1x = this.vertex1.x;
@@ -201,6 +244,14 @@ var Face = new Class({
201244
return (u >= 0 && v >= 0 && (u + v < 1));
202245
},
203246

247+
/**
248+
* Return `true` if the vertices of this Face wind counter-clockwise.
249+
*
250+
* @method Phaser.Geom.Mesh.Face#isCounterClockwise
251+
* @since 3.50.0
252+
*
253+
* @return {boolean} `true` if the vertices of this Face wind counter-clockwise , otherwise `false`.
254+
*/
204255
isCounterClockwise: function ()
205256
{
206257
var v1 = this.vertex1;
@@ -210,6 +261,13 @@ var Face = new Class({
210261
return (v2.x - v1.x) * (v3.y - v1.y) - (v2.y - v1.y) * (v3.x - v1.x) >= 0;
211262
},
212263

264+
/**
265+
* Returns the horizontal in center of this Face. If set, translates the Face by the given amount.
266+
*
267+
* @name Phaser.Geom.Mesh.Face#x
268+
* @type {number}
269+
* @since 3.50.0
270+
*/
213271
x: {
214272

215273
get: function ()
@@ -226,6 +284,13 @@ var Face = new Class({
226284

227285
},
228286

287+
/**
288+
* Returns the vertical in center of this Face. If set, translates the Face by the given amount.
289+
*
290+
* @name Phaser.Geom.Mesh.Face#y
291+
* @type {number}
292+
* @since 3.50.0
293+
*/
229294
y: {
230295

231296
get: function ()
@@ -242,6 +307,14 @@ var Face = new Class({
242307

243308
},
244309

310+
/**
311+
* The averaged depth of this Face.
312+
*
313+
* @name Phaser.Geom.Mesh.Face#depth
314+
* @type {number}
315+
* @readonly
316+
* @since 3.50.0
317+
*/
245318
depth: {
246319

247320
get: function ()
@@ -255,6 +328,12 @@ var Face = new Class({
255328

256329
},
257330

331+
/**
332+
* Destroys this Face and its references.
333+
*
334+
* @method Phaser.Geom.Mesh.Face#destroy
335+
* @since 3.50.0
336+
*/
258337
destroy: function ()
259338
{
260339
this.vertex1 = null;

0 commit comments

Comments
 (0)