diff options
| author | ryderr <r@okfoc.us> | 2014-10-02 16:03:45 -0400 |
|---|---|---|
| committer | ryderr <r@okfoc.us> | 2014-10-02 16:03:45 -0400 |
| commit | 1f9e1bc496d1b62ceb23c2e7296b865630509e88 (patch) | |
| tree | b68aea7d62e2e45068cb67692fe05cce914de3ff /public/assets/javascripts/rectangles/models/vec2.js | |
| parent | 34d01bfd89106953d1ecb42debd5ee565ae926f8 (diff) | |
| parent | 04fab20e51e5dbc30a8c3e440fcfb16730c424ab (diff) | |
Merge branch 'master' of github.com:okfocus/vvalls
Diffstat (limited to 'public/assets/javascripts/rectangles/models/vec2.js')
| -rw-r--r-- | public/assets/javascripts/rectangles/models/vec2.js | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/public/assets/javascripts/rectangles/models/vec2.js b/public/assets/javascripts/rectangles/models/vec2.js index 0040435..a5a832e 100644 --- a/public/assets/javascripts/rectangles/models/vec2.js +++ b/public/assets/javascripts/rectangles/models/vec2.js @@ -37,6 +37,9 @@ vec2.prototype.midpoint = function(){ return lerp(0.5, this.a, this.b) } + vec2.prototype.lerp = function(n){ + return lerp(n, this.a, this.b) + } vec2.prototype.eq = function(v){ return this.a == v.a && this.b == v.b } @@ -63,6 +66,10 @@ vec2.prototype.zero = function(){ this.a = this.b = 0 } + vec2.prototype.round = function(){ + this.a = Math.round(this.a) + this.b = Math.round(this.b) + } vec2.prototype.setPosition = function(n){ var len = this.length() this.a = n |
