bool intersects(Rectangle rect)
{
Vector2 circleDistance;
circleDistance.X = Math.Abs(Position.X - rect.X - rect.Width / 2);
circleDistance.Y = Math.Abs(Position.Y - rect.Y - rect.Height / 2);
if (circleDistance.X > (rect.Width / 2 + radius)) { return false; }
if (circleDistance.Y > (rect.Height / 2 + radius)) { return false; }
if (circleDistance.X <= (rect.Width / 2)) { return true; }
if (circleDistance.Y <= (rect.Height / 2)) { return true; }
float cornerDistance_sq = (float)(Math.Pow((circleDistance.X - rect.Width / 2), 2) + Math.Pow((circleDistance.Y - rect.Height / 2), 2));
return (cornerDistance_sq <= (Math.Pow(radius, 2)));
}