From f88623a1e06bc686861ba948368f9a3e11062d13 Mon Sep 17 00:00:00 2001 From: Derek McQuay Date: Sat, 27 Aug 2016 21:32:18 -0700 Subject: [PATCH] adding corrections for spelling and golint --- line.go | 2 +- rectangle.go | 22 +++++++++++----------- rectangle_test.go | 2 +- 3 files changed, 13 insertions(+), 13 deletions(-) diff --git a/line.go b/line.go index 4812186..a8337e0 100644 --- a/line.go +++ b/line.go @@ -10,7 +10,7 @@ type line struct { pt1, pt2 Point } -// determinants aids by calculating necesary values for performing +// determinants aids by calculating necessary values for performing // calculations using the determinant of two points func determinants(l line) (float64, float64, float64) { a := l.pt2.Y - l.pt1.Y diff --git a/rectangle.go b/rectangle.go index d4cc66e..50e7d1a 100644 --- a/rectangle.go +++ b/rectangle.go @@ -70,17 +70,17 @@ func (r Rectangle) size() float64 { // pts[3] -- pts[1], and pts[3] -- pts[2] func (r Rectangle) inOrder() []Point { n1, n2 := r.neighbors(r.P1) - accross := &Point{} + across := &Point{} if r.P2 != n1 || r.P2 != n2 { - accross = &r.P2 + across = &r.P2 } if r.P3 != n1 || r.P3 != n2 { - accross = &r.P3 + across = &r.P3 } if r.P4 != n1 || r.P4 != n2 { - accross = &r.P4 + across = &r.P4 } - return []Point{r.P1, n1, n2, *accross} + return []Point{r.P1, n1, n2, *across} } // Adjacency detects whether two rectangles, r1, and r2, are adjacent. @@ -151,23 +151,23 @@ func Intersection(r1, r2 Rectangle) []Point { func sumOfTri(r Rectangle, p Point) bool { n1, n2 := r.neighbors(r.P1) x1, x2 := Point{}, Point{} - accross := &Point{} + across := &Point{} if r.P2 != n1 || r.P2 != n2 { - accross = &r.P2 + across = &r.P2 x1, x2 = r.neighbors(r.P2) } if r.P3 != n1 || r.P3 != n2 { - accross = &r.P3 + across = &r.P3 x1, x2 = r.neighbors(r.P3) } if r.P4 != n1 || r.P4 != n2 { - accross = &r.P4 + across = &r.P4 x1, x2 = r.neighbors(r.P4) } sumTri := sizeTriangle(r.P1, n1, p) + sizeTriangle(r.P1, n2, p) + - sizeTriangle(*accross, x1, p) + - sizeTriangle(*accross, x2, p) + sizeTriangle(*across, x1, p) + + sizeTriangle(*across, x2, p) if math.Abs(r.size()-sumTri) < ɛ { return true } diff --git a/rectangle_test.go b/rectangle_test.go index 7ec6014..487ae4e 100644 --- a/rectangle_test.go +++ b/rectangle_test.go @@ -179,7 +179,7 @@ func TestIntersection(t *testing.T) { ) continue } - for i, _ := range actual { + for i := range actual { if actual[i] != rt.expected[i] { t.Errorf( "failed intersection:\n\texpected: %v\n\t actual: %v",