public static void IntersectsWith(this Rectangle rect, ref Circle circle, out bool result) { float testX = circle.X; float testY = circle.Y; if (testX < rect.Left) testX = rect.Left; if (testX > rect.Right) testX = rect.Right; if (testY < rect.Top) testY = rect.Top; if (testY > rect.Bottom) testY = rect.Bottom; result = ((circle.X - testX) * (circle.X - testX) + (circle.Y - testY) * (circle.Y - testY)) < circle.Radius * circle.Radius; }
public static bool IntersectsWith(this Rectangle rect, Circle circle) { float testX = circle.X; float testY = circle.Y; if (testX < rect.Left) testX = rect.Left; if (testX > rect.Right) testX = rect.Right; if (testY < rect.Top) testY = rect.Top; if (testY > rect.Bottom) testY = rect.Bottom; return ((circle.X - testX) * (circle.X - testX) + (circle.Y - testY) * (circle.Y - testY)) < circle.Radius * circle.Radius; }
public bool Contains(Circle circle) { return Math.Sqrt((X - circle.X) * (X - circle.X) + (Y - circle.Y) * (Y - circle.Y)) + circle.Radius <= Radius; }
public bool IntersectsWith(Circle circle) { return Radius + circle.Radius >= Math.Sqrt((X - circle.X) * (X - circle.X) + (Y - circle.Y) * (Y - circle.Y)); }
public static void Contains(this Rectangle r, ref Circle circle, out bool result) { result = (r.X > circle.X - circle.Radius || r.Right < circle.X + circle.Radius || r.Y > circle.Y - circle.Radius || r.Bottom < circle.Y - circle.Radius); }
public static bool Contains(this Rectangle r, Circle circle) { return (r.X > circle.X - circle.Radius || r.Right < circle.X + circle.Radius || r.Y > circle.Y - circle.Radius || r.Bottom < circle.Y - circle.Radius); }
public bool Collides(Circle collider) { return Circle.IntersectsWith(collider); }
public void AddShadowCaster(Circle circle) { throw new NotImplementedException(); }