diff --git a/geometry.go b/geometry.go index 61b93ca..55fbf53 100644 --- a/geometry.go +++ b/geometry.go @@ -392,16 +392,16 @@ func (c Circle) Contains(u Vec) bool { return c.Radius >= toCenter.Len() } -// MaxCircle will return the larger circle based on the radius. -func MaxCircle(c, d Circle) Circle { +// maxCircle will return the larger circle based on the radius. +func maxCircle(c, d Circle) Circle { if c.Radius < d.Radius { return d } return c } -// MinCircle will return the smaller circle based on the radius. -func MinCircle(c, d Circle) Circle { +// minCircle will return the smaller circle based on the radius. +func minCircle(c, d Circle) Circle { if c.Radius < d.Radius { return c } @@ -410,8 +410,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, d) + smallerC := minCircle(c, d) // Get distance between centers dist := c.Center.To(d.Center).Len() @@ -440,8 +440,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, d) + smallerC := minCircle(c, d) if biggerC.Radius >= biggerC.Center.To(smallerC.Center).Len()+smallerC.Radius { return biggerC diff --git a/geometry_test.go b/geometry_test.go index 4cab36f..f7308c5 100644 --- a/geometry_test.go +++ b/geometry_test.go @@ -576,79 +576,3 @@ func TestCircle_Intersect(t *testing.T) { }) } } - -func TestMaxCircle(t *testing.T) { - bigCircle := pixel.C(10, pixel.ZV) - smallCircle := pixel.C(1, pixel.ZV) - - type args struct { - c pixel.Circle - d pixel.Circle - } - tests := []struct { - name string - args args - want pixel.Circle - }{ - { - name: "MaxCircle(): first bigger", - args: args{c: bigCircle, d: smallCircle}, - want: bigCircle, - }, - { - name: "MaxCircle(): first smaller", - args: args{c: smallCircle, d: bigCircle}, - want: bigCircle, - }, - { - name: "MaxCircle(): both same size", - args: args{c: smallCircle, d: smallCircle}, - want: smallCircle, - }, - } - for _, tt := range tests { - t.Run(tt.name, func(t *testing.T) { - if got := pixel.MaxCircle(tt.args.c, tt.args.d); !reflect.DeepEqual(got, tt.want) { - t.Errorf("MaxCircle() = %v, want %v", got, tt.want) - } - }) - } -} - -func TestMinCircle(t *testing.T) { - bigCircle := pixel.C(10, pixel.ZV) - smallCircle := pixel.C(1, pixel.ZV) - - type args struct { - c pixel.Circle - d pixel.Circle - } - tests := []struct { - name string - args args - want pixel.Circle - }{ - { - name: "MinCircle(): first bigger", - args: args{c: bigCircle, d: smallCircle}, - want: smallCircle, - }, - { - name: "MinCircle(): first smaller", - args: args{c: smallCircle, d: bigCircle}, - want: smallCircle, - }, - { - name: "MinCircle(): both same size", - args: args{c: smallCircle, d: smallCircle}, - want: smallCircle, - }, - } - for _, tt := range tests { - t.Run(tt.name, func(t *testing.T) { - if got := pixel.MinCircle(tt.args.c, tt.args.d); !reflect.DeepEqual(got, tt.want) { - t.Errorf("MinCircle() = %v, want %v", got, tt.want) - } - }) - } -}