Beispiel #1
0
 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;
 }
Beispiel #2
0
 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;
 }
Beispiel #3
0
 public bool Contains(Circle circle)
 {
     return Math.Sqrt((X - circle.X) * (X - circle.X) + (Y - circle.Y) * (Y - circle.Y)) + circle.Radius <= Radius;
 }
Beispiel #4
0
 public bool IntersectsWith(Circle circle)
 {
     return Radius + circle.Radius >= Math.Sqrt((X - circle.X) * (X - circle.X) + (Y - circle.Y) * (Y - circle.Y));
 }
Beispiel #5
0
 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);
 }
Beispiel #6
0
 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);
 }
Beispiel #8
0
 public void AddShadowCaster(Circle circle)
 {
     throw new NotImplementedException();
 }