comparison pkg/octree/tree.go @ 778:9be20bd0f131

Fixed a bug with 2d planes (lines) found while working on line intersections. Added unit test.
author Sascha L. Teichmann <sascha.teichmann@intevation.de>
date Wed, 26 Sep 2018 13:17:32 +0200
parents c55771b7c502
children 3d927e06b92c
comparison
equal deleted inserted replaced
777:f27bfc57143b 778:9be20bd0f131
98 98
99 v0 := line.Eval(t[0].X, t[0].Y) 99 v0 := line.Eval(t[0].X, t[0].Y)
100 v1 := line.Eval(t[1].X, t[1].Y) 100 v1 := line.Eval(t[1].X, t[1].Y)
101 v2 := line.Eval(t[2].X, t[2].Y) 101 v2 := line.Eval(t[2].X, t[2].Y)
102 102
103 if math.Abs(v0) < eps || math.Abs(v1) < eps || 103 if math.Abs(v0) < epsPlane ||
104 math.Abs(v2) < eps || 104 math.Abs(v1) < epsPlane ||
105 math.Abs(v2) < epsPlane ||
105 sides(sides(sides(0, v0), v1), v2) == 3 { 106 sides(sides(sides(0, v0), v1), v2) == 3 {
106 fn(&t) 107 fn(&t)
107 } 108 }
108 dupes[idx] = struct{}{} 109 dupes[idx] = struct{}{}
109 } 110 }