summaryrefslogtreecommitdiff
path: root/public/assets/javascripts/rectangles/models
diff options
context:
space:
mode:
authorJules Laplace <jules@okfoc.us>2014-11-03 12:45:43 -0500
committerJules Laplace <jules@okfoc.us>2014-11-03 12:45:43 -0500
commitb520c42277cfa0638963142bf7bc087f8ab24b8c (patch)
treeb6eb0d0b26826dca28bfdd32b66de62ab99dcbc1 /public/assets/javascripts/rectangles/models
parent22bf04c9b56fafadc3c3be54dceb6665243331cd (diff)
parent18f1bc14f610cdb0dddd273e8c55ea5c2e547a94 (diff)
merge
Diffstat (limited to 'public/assets/javascripts/rectangles/models')
-rw-r--r--public/assets/javascripts/rectangles/models/wall.js28
1 files changed, 28 insertions, 0 deletions
diff --git a/public/assets/javascripts/rectangles/models/wall.js b/public/assets/javascripts/rectangles/models/wall.js
index 8590de7..a026c3c 100644
--- a/public/assets/javascripts/rectangles/models/wall.js
+++ b/public/assets/javascripts/rectangles/models/wall.js
@@ -25,6 +25,34 @@
Wall.prototype.toString = function(){
return this.vec.toString()
}
+ Wall.prototype.get_points = function(wall_vec){
+ wall_vec = wall_vec || new Rect ()
+ if (this.side & LEFT) {
+ wall_vec.x.a = this.edge
+ wall_vec.x.b = this.vec.b
+ wall_vec.y.a = this.edge
+ wall_vec.y.b = this.vec.a
+ }
+ else if (this.side & RIGHT) {
+ wall_vec.x.a = this.edge
+ wall_vec.x.b = this.vec.a
+ wall_vec.y.a = this.edge
+ wall_vec.y.b = this.vec.b
+ }
+ else if (this.side & FRONT) {
+ wall_vec.x.a = this.vec.a
+ wall_vec.x.b = this.edge
+ wall_vec.y.a = this.vec.b
+ wall_vec.y.b = this.edge
+ }
+ else if (this.side & BACK) {
+ wall_vec.x.a = this.vec.b
+ wall_vec.x.b = this.edge
+ wall_vec.y.a = this.vec.a
+ wall_vec.y.b = this.edge
+ }
+ return wall_vec
+ }
Wall.prototype.reset = function(){
}