diff pkg/octree/vertex.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 c91e759007da
children
line wrap: on
line diff
--- a/pkg/octree/vertex.go	Sat Oct 19 23:07:59 2019 +0200
+++ b/pkg/octree/vertex.go	Mon Oct 21 02:01:56 2019 +0200
@@ -113,6 +113,16 @@
 		a.Y1 >= b.Y1 && a.Y2 <= b.Y2
 }
 
+func (a Box2D) Size() (float64, float64) {
+	return a.X2 - a.X1, a.Y2 - a.Y1
+}
+
+func (a Box2D) Empty() bool {
+	const eps = 0.0000001
+	return math.Abs(a.X2-a.X1) < eps &&
+		math.Abs(a.Y2-a.Y1) < eps
+}
+
 func (p Plane3D) Z(x, y float64) float64 {
 	// p.A*x + p.B*y + p.C*z + p.D = 0
 	return -(p.A*x + p.B*y + p.D) / p.C