From 56cd321ab883bed9867ff0acd9849a47cfbb4689 Mon Sep 17 00:00:00 2001 From: Ben Cragg Date: Tue, 29 Jan 2019 11:33:12 +0000 Subject: [PATCH] normalising before getting bigger/smaller --- geometry.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/geometry.go b/geometry.go index 7e17924..fd9b3c3 100644 --- a/geometry.go +++ b/geometry.go @@ -407,8 +407,8 @@ func minCircle(c, d Circle) Circle { // Union returns the minimal Circle which covers both `c` and `d`. func (c Circle) Union(d Circle) Circle { - biggerC := maxCircle(c, d) - smallerC := minCircle(c, d) + biggerC := maxCircle(c.Norm(), d.Norm()) + smallerC := minCircle(c.Norm(), d.Norm()) // Get distance between centers dist := c.Center.To(d.Center).Len() @@ -437,8 +437,8 @@ func (c Circle) Union(d Circle) Circle { // centers. func (c Circle) Intersect(d Circle) Circle { // Check if one of the circles encompasses the other; if so, return that one - biggerC := maxCircle(c, d) - smallerC := minCircle(c, d) + biggerC := maxCircle(c.Norm(), d.Norm()) + smallerC := minCircle(c.Norm(), d.Norm()) if biggerC.Radius >= biggerC.Center.To(smallerC.Center).Len()+smallerC.Radius { return biggerC