summaryrefslogtreecommitdiff
path: root/public/assets/javascripts/rectangles/models/vec3.js
diff options
context:
space:
mode:
Diffstat (limited to 'public/assets/javascripts/rectangles/models/vec3.js')
-rw-r--r--public/assets/javascripts/rectangles/models/vec3.js18
1 files changed, 17 insertions, 1 deletions
diff --git a/public/assets/javascripts/rectangles/models/vec3.js b/public/assets/javascripts/rectangles/models/vec3.js
index 97329ed..b3825a9 100644
--- a/public/assets/javascripts/rectangles/models/vec3.js
+++ b/public/assets/javascripts/rectangles/models/vec3.js
@@ -39,5 +39,21 @@ vec3.prototype.serialize = function(){
vec3.prototype.deserialize = function(data){
this.a = data[0]
this.b = data[1]
- this.c = data[2]
+ this.c = data[2] || data[0]
+ return this
+}
+vec3.prototype.clone = function(){
+ return new vec3(this.a, this.b, this.c)
+}
+vec3.prototype.assign = function(v){
+ this.a = v.a
+ this.b = v.b
+ this.c = v.c
+ return this
+}
+vec3.prototype.mul = function(n) {
+ this.a *= n
+ this.b *= n
+ this.c *= n
+ return this
} \ No newline at end of file