From 4da6259061060a43fe76f89fa908935536e2b666 Mon Sep 17 00:00:00 2001 From: Jules Laplace Date: Fri, 11 Apr 2014 15:20:35 -0400 Subject: AABB intersection, handling most cases --- vec2.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'vec2.js') diff --git a/vec2.js b/vec2.js index 8bc8410..973613f 100644 --- a/vec2.js +++ b/vec2.js @@ -43,7 +43,7 @@ vec2.prototype.contains = function(n){ } // assumes (vec2)v falls to the right of (vec2)this vec2.prototype.intersects = function(v){ - return (this.b > v.a) || (v.b > this.a) + return (this.b > v.a && this.b < v.b) || (v.b > this.a && v.b < this.b) } vec2.prototype.union = function(v){ if (this.intersects(v)) { -- cgit v1.2.3-70-g09d2