Mercurial > gemma
diff pkg/octree/strtree.go @ 4768:a2f16bbcc846 direct-diff
Morph differences: Directly raster A and subtract B as a raster.
author | Sascha L. Teichmann <sascha.teichmann@intevation.de> |
---|---|
date | Mon, 21 Oct 2019 02:01:56 +0200 |
parents | 9eb708176b43 |
children |
line wrap: on
line diff
--- a/pkg/octree/strtree.go Sat Oct 19 23:07:59 2019 +0200 +++ b/pkg/octree/strtree.go Mon Oct 21 02:01:56 2019 +0200 @@ -484,51 +484,3 @@ } return int32(-(pos + 1)) } - -func (s *STRTree) Diff(other *STRTree) PointMap { - - firstVs, secondVs := s.tin.Vertices, other.tin.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 := s.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 -}