# HG changeset patch # User Sascha L. Teichmann # Date 1551707902 -3600 # Node ID 62adfe9cbbde97180805f238cefa368b2d109551 # Parent 843f39b9327e15774f4b898752203ce3c7390684 Be more precise with clipping nodes. diff -r 843f39b9327e -r 62adfe9cbbde pkg/octree/tree.go --- a/pkg/octree/tree.go Mon Mar 04 14:46:49 2019 +0100 +++ b/pkg/octree/tree.go Mon Mar 04 14:58:22 2019 +0100 @@ -80,10 +80,12 @@ case IntersectionOutSide: // all outside -> clip from tree. nodesClipped++ - if index := ot.index[top.pos:]; len(index) > 7 { - for i := range index { - index[i] = 0 - } + index := ot.index[top.pos:] + if len(index) > 8 { + index = index[:8] + } + for i := range index { + index[i] = 0 } continue frames default: // Overlaps @@ -106,12 +108,14 @@ switch p.IntersectionBox2D(nbox) { case IntersectionInside: // all inside so nothing to clip. + nodesAllInside++ continue children case IntersectionOutSide: // all are ouside -> clip from tree. + nodesClipped++ index[i] = 0 index[i+4] = 0 - continue + continue children default: // Overlaps if a != 0 { stack = append(stack, boxFrame{a, nbox})