changeset 2500:5c3e63cfd50d octree-diff

More counting of clipped nodes.
author Sascha L. Teichmann <sascha.teichmann@intevation.de>
date Mon, 04 Mar 2019 15:16:39 +0100
parents 62adfe9cbbde
children e0a7571ac13a
files pkg/octree/tree.go
diffstat 1 files changed, 12 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/pkg/octree/tree.go	Mon Mar 04 14:58:22 2019 +0100
+++ b/pkg/octree/tree.go	Mon Mar 04 15:16:39 2019 +0100
@@ -79,13 +79,15 @@
 				continue frames
 			case IntersectionOutSide:
 				// all outside -> clip from tree.
-				nodesClipped++
 				index := ot.index[top.pos:]
 				if len(index) > 8 {
 					index = index[:8]
 				}
 				for i := range index {
-					index[i] = 0
+					if index[i] != 0 {
+						index[i] = 0
+						nodesClipped++
+					}
 				}
 				continue frames
 			default: // Overlaps
@@ -112,9 +114,14 @@
 							continue children
 						case IntersectionOutSide:
 							// all are ouside -> clip from tree.
-							nodesClipped++
-							index[i] = 0
-							index[i+4] = 0
+							if a != 0 {
+								index[i] = 0
+								nodesClipped++
+							}
+							if b != 0 {
+								index[i+4] = 0
+								nodesClipped++
+							}
 							continue children
 						default: // Overlaps
 							if a != 0 {