changeset 761:033975d49c90

Removed a bit debug output on vertical traversal of octree.
author Sascha L. Teichmann <sascha.teichmann@intevation.de>
date Tue, 25 Sep 2018 10:09:33 +0200
parents 6f913badee5d
children 01ba06da8f46
files pkg/controllers/octreecross.go pkg/octree/tree.go
diffstat 2 files changed, 4 insertions(+), 13 deletions(-) [+]
line wrap: on
line diff
--- a/pkg/controllers/octreecross.go	Tue Sep 25 09:53:59 2018 +0200
+++ b/pkg/controllers/octreecross.go	Tue Sep 25 10:09:33 2018 +0200
@@ -79,6 +79,7 @@
 	}
 
 	for i := 0; i < len(coords)-1; i++ {
+		start = time.Now()
 		var count int
 		c1 := &coords[i]
 		c2 := &coords[i+1]
@@ -86,6 +87,7 @@
 			// TODO: Do real intersection.
 			count++
 		})
+		log.Printf("octree traversal took: %s\n", time.Since(start))
 		log.Printf("triangles to intersect: %d\n", count)
 	}
 
--- a/pkg/octree/tree.go	Tue Sep 25 09:53:59 2018 +0200
+++ b/pkg/octree/tree.go	Tue Sep 25 10:09:33 2018 +0200
@@ -1,7 +1,6 @@
 package octree
 
 import (
-	"log"
 	"math"
 )
 
@@ -133,14 +132,11 @@
 	dupes := map[int32]struct{}{}
 
 	all := box2d{ot.Min.X, ot.Min.Y, ot.Max.X, ot.Max.Y}
-	log.Printf("area: %f\n", (box.x2-box.x1)*(box.y2-box.y1))
-	log.Printf("all: %f\n", (all.x2-all.x1)*(all.y2-all.y1))
+	//log.Printf("area: %f\n", (box.x2-box.x1)*(box.y2-box.y1))
+	//log.Printf("all: %f\n", (all.x2-all.x1)*(all.y2-all.y1))
 
 	stack := []frame{{1, all}}
 
-	var lineRejected int
-	var dupeRejected int
-
 	for len(stack) > 0 {
 		top := stack[len(stack)-1]
 		stack = stack[:len(stack)-1]
@@ -176,7 +172,6 @@
 
 			for _, idx := range indices {
 				if _, found := dupes[idx]; found {
-					dupeRejected++
 					continue
 				}
 				tri := ot.triangles[idx]
@@ -194,17 +189,11 @@
 					math.Abs(v2) < eps ||
 					sides(sides(sides(0, v0), v1), v2) == 3 {
 					fn(&t)
-				} else {
-					lineRejected++
 				}
 				dupes[idx] = struct{}{}
 			}
 		}
 	}
-
-	// XXX: This value seems too high!
-	log.Printf("rejected by line test: %d %d %d\n",
-		lineRejected, len(dupes), dupeRejected)
 }
 
 func (ot *Tree) Horizontal(h float64, fn func(*Triangle)) {