comparison pkg/octree/builder.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 930ca9c4e2a7
children 4233570de212
comparison
equal deleted inserted replaced
2515:6bcaa8bf2603 2516:1ec4c5633eb6
69 func NewBuilder(t *Tin) *Builder { 69 func NewBuilder(t *Tin) *Builder {
70 return &Builder{t: t} 70 return &Builder{t: t}
71 } 71 }
72 72
73 // Build builds the Octree. 73 // Build builds the Octree.
74 func (tb *Builder) Build() { 74 func (tb *Builder) Build(removed map[int32]struct{}) {
75 75
76 triangles := make([]int32, len(tb.t.Triangles)) 76 var triangles []int32
77 for i := range triangles { 77
78 triangles[i] = int32(i) 78 if len(removed) > 0 {
79 triangles = make([]int32, len(tb.t.Triangles)-len(removed))
80 idx := 0
81 for i := range tb.t.Triangles {
82 if _, found := removed[int32(i)]; !found {
83 triangles[idx] = int32(i)
84 idx++
85 }
86 }
87 } else {
88 triangles = make([]int32, len(tb.t.Triangles))
89 for i := range triangles {
90 triangles[i] = int32(i)
91 }
79 } 92 }
80 93
81 n := runtime.NumCPU() 94 n := runtime.NumCPU()
82 95
83 steps := make(chan buildStep) 96 steps := make(chan buildStep)