Skip to content

Commit 3d09a83

Browse files
committed
Added Vector.equals methods.
1 parent a89c6a8 commit 3d09a83

3 files changed

Lines changed: 16 additions & 1 deletion

File tree

v3/src/math/Vector2.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,13 @@ var Vector2 = new Class({
5050
return this;
5151
},
5252

53-
angle: function () {
53+
equals: function (v)
54+
{
55+
return ((this.x === v.x) && (this.y === v.y));
56+
},
5457

58+
angle: function ()
59+
{
5560
// computes the angle in radians with respect to the positive x-axis
5661

5762
var angle = Math.atan2(this.y, this.x);

v3/src/math/Vector3.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,11 @@ var Vector3 = new Class({
4444
return this;
4545
},
4646

47+
equals: function (v)
48+
{
49+
return ((this.x === v.x) && (this.y === v.y) && (this.z === v.z));
50+
},
51+
4752
copy: function (src)
4853
{
4954
this.x = src.x;

v3/src/math/Vector4.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,11 @@ var Vector4 = new Class({
4040
return this;
4141
},
4242

43+
equals: function (v)
44+
{
45+
return ((this.x === v.x) && (this.y === v.y) && (this.z === v.z) && (this.w === v.w));
46+
},
47+
4348
set: function (x, y, z, w)
4449
{
4550
if (typeof x === 'object')

0 commit comments

Comments
 (0)