diff cmd/octreediff/main.go @ 2516:1ec4c5633eb6 octree-diff

Clip STR tree and not Octree.
author Sascha L. Teichmann <sascha.teichmann@intevation.de>
date Tue, 05 Mar 2019 17:08:16 +0100
parents 1534df518201
children 7686c7c23506
line wrap: on
line diff
--- a/cmd/octreediff/main.go	Tue Mar 05 15:55:14 2019 +0100
+++ b/cmd/octreediff/main.go	Tue Mar 05 17:08:16 2019 +0100
@@ -395,26 +395,29 @@
 
 		var str octree.STRTree
 
-		str.Build(tri)
+		tin := tri.Tin()
+
+		str.Build(tin)
 
 		now = time.Now()
 		log.Printf("building STR tree took %v\n", now.Sub(last))
 		last = now
 
-		builder := octree.NewBuilder(tri.Tin())
-		builder.Build()
+		removed := str.Clip(&clippingPolygon)
+		now = time.Now()
+		log.Printf("clipping STR tree took %v\n", now.Sub(last))
+		last = now
+
+		log.Printf("Number of triangles to clip: %d\n", len(removed))
+
+		builder := octree.NewBuilder(tin)
+		builder.Build(removed)
 
 		now = time.Now()
 		log.Printf("building octree took %v\n", now.Sub(last))
 		last = now
 
 		tree := builder.Tree()
-		tree.Clip(&clippingPolygon)
-		//tree.Dump()
-
-		now = time.Now()
-		log.Printf("clipping octree took %v\n", now.Sub(last))
-		last = now
 
 		log.Printf("min/max: %f %f\n", tree.Min.Z, tree.Max.Z)