Пример #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;
 }
Пример #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;
 }
Пример #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;
 }
Пример #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));
 }
Пример #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);
 }
Пример #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);
 }
Пример #7
0
 public bool Collides(Circle collider)
 {
     return Circle.IntersectsWith(collider);
 }
Пример #8
0
 public void AddShadowCaster(Circle circle)
 {
     throw new NotImplementedException();
 }