remove local var
This commit is contained in:
parent
44d030b9ca
commit
23168ee324
|
@ -483,15 +483,12 @@ func (c Circle) Intersect(d Circle) Circle {
|
|||
// - An edge of the Rect is a tangent to the Circle
|
||||
func (c Circle) IntersectsRect(r Rect) bool {
|
||||
// Checks if the c.Center is not in the diagonal quadrants of the rectangle
|
||||
var grownR Rect
|
||||
if (r.Min.X <= c.Center.X && c.Center.X <= r.Max.X) || (r.Min.Y <= c.Center.Y && c.Center.Y <= r.Max.Y) {
|
||||
// 'grow' the Rect by c.Radius in each diagonal
|
||||
grownR = Rect{
|
||||
return Rect{
|
||||
Min: r.Min.Sub(V(c.Radius, c.Radius)),
|
||||
Max: r.Max.Add(V(c.Radius, c.Radius)),
|
||||
}
|
||||
|
||||
return grownR.Contains(c.Center)
|
||||
}.Contains(c.Center)
|
||||
}
|
||||
// The center is in the diagonal quadrants
|
||||
return c.Center.To(r.Min).Len() <= c.Radius || c.Center.To(r.Max).Len() <= c.Radius
|
||||
|
|
Loading…
Reference in New Issue