Skip to content

Commit

Permalink
Added subScalar to Vector2 and Vector4 too.
Browse files Browse the repository at this point in the history
  • Loading branch information
mrdoob committed Mar 14, 2015
1 parent 6f85b74 commit 1f97cfa
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 6 deletions.
21 changes: 15 additions & 6 deletions src/math/Vector2.js
Original file line number Diff line number Diff line change
Expand Up @@ -90,19 +90,19 @@ THREE.Vector2.prototype = {

},

addVectors: function ( a, b ) {
addScalar: function ( s ) {

this.x = a.x + b.x;
this.y = a.y + b.y;
this.x += s;
this.y += s;

return this;

},

addScalar: function ( s ) {
addVectors: function ( a, b ) {

this.x += s;
this.y += s;
this.x = a.x + b.x;
this.y = a.y + b.y;

return this;

Expand All @@ -124,6 +124,15 @@ THREE.Vector2.prototype = {

},

subScalar: function ( s ) {

this.x -= s;
this.y -= s;

return this;

},

subVectors: function ( a, b ) {

this.x = a.x - b.x;
Expand Down
11 changes: 11 additions & 0 deletions src/math/Vector4.js
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,17 @@ THREE.Vector4.prototype = {

},

subScalar: function ( s ) {

this.x -= s;
this.y -= s;
this.z -= s;
this.w -= s;

return this;

},

subVectors: function ( a, b ) {

this.x = a.x - b.x;
Expand Down

0 comments on commit 1f97cfa

Please sign in to comment.