Mercurial > gemma
diff pkg/octree/tree.go @ 4658:4bbfe3dd2ab5 stree-experiment
Completed usage of STRTrees.
author | Sascha L. Teichmann <sascha.teichmann@intevation.de> |
---|---|
date | Mon, 14 Oct 2019 14:58:04 +0200 |
parents | 3eda5a7215ab |
children |
line wrap: on
line diff
--- a/pkg/octree/tree.go Mon Oct 14 13:18:15 2019 +0200 +++ b/pkg/octree/tree.go Mon Oct 14 14:58:04 2019 +0200 @@ -312,51 +312,3 @@ } } } - -func (ot *Tree) Diff(other *Tree) PointMap { - - firstVs, secondVs := ot.Vertices(), other.Vertices() - - result := make(PointMap, len(firstVs)+len(secondVs)) - - sliceWork( - firstVs, - result, - func(slice []Vertex, turn func([]Vertex) []Vertex) { - p := turn(nil) - for i := range slice { - v := &slice[i] - if z, found := other.Value(v.X, v.Y); found { - p = append(p, Vertex{v.X, v.Y, v.Z - z}) - if len(p) == cap(p) { - p = turn(p) - } - } - } - if len(p) > 0 { - turn(p) - } - }) - - sliceWork( - secondVs, - result, - func( - slice []Vertex, turn func([]Vertex) []Vertex) { - p := turn(nil) - for i := range slice { - v := &slice[i] - if z, found := ot.Value(v.X, v.Y); found { - p = append(p, Vertex{v.X, v.Y, z - v.Z}) - if len(p) == cap(p) { - p = turn(p) - } - } - } - if len(p) > 0 { - turn(p) - } - }) - - return result -}