summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJulie Lala <jules@okfoc.us>2014-04-12 01:34:29 -0400
committerJulie Lala <jules@okfoc.us>2014-04-12 01:34:29 -0400
commitc5f3ae57f3e1694f41409449dce71edc5dde2e6e (patch)
treecbb0989531c8cc3bd2fbcada3e8b40db28b4df79
parent96d255768aa77b146e40a3855cb85dcb54f4e689 (diff)
fix split bug
-rw-r--r--rect.js8
-rw-r--r--rectangles.html1
2 files changed, 7 insertions, 2 deletions
diff --git a/rect.js b/rect.js
index 19e69b7..732a344 100644
--- a/rect.js
+++ b/rect.js
@@ -97,7 +97,7 @@ rect.prototype.split = function(r){
x_intervals.push( new vec2( r.x.b, this.x.b ))
}
- else if (r.x.contains(this.x.a) && r.x.contains(r.x.b)) {
+ else { // if (r.x.contains(this.x.a) && r.x.contains(r.x.b)) {
x_intervals.push( new vec2( this.x.a, this.x.b ))
}
@@ -119,9 +119,11 @@ rect.prototype.split = function(r){
y_intervals.push( new vec2( r.y.b, this.y.b ))
}
- else if (r.y.contains(this.y.a) && this.y.contains(r.y.b)) {
+ else { // if (r.y.contains(this.y.a) && this.y.contains(r.y.b)) {
y_intervals.push( new vec2( this.y.a, this.y.b ))
}
+if (zz)
+console.log(x_intervals.length, y_intervals.length)
x_intervals.forEach(function(x){
y_intervals.forEach(function(y){
@@ -131,3 +133,5 @@ rect.prototype.split = function(r){
return splits
}
+zz = false
+document.body.addEventListener("click", function(){ zz = true }) \ No newline at end of file
diff --git a/rectangles.html b/rectangles.html
index 94bca0f..a68b4c6 100644
--- a/rectangles.html
+++ b/rectangles.html
@@ -202,6 +202,7 @@ function solve_rects(){
// generate ceiling-walls where ceiling has discontinuity
document.getElementById("intersects").innerHTML = regions.join("<br>")
+zz=false
regions = regions.filter(function(r){ return !!r })
for (var i = 0; i < regions.length; i++) {