public static IEnumerable <Actor> FindUnitsInCircle(this World world, int2 a, int r) { using (new PerfSample("FindUnitsInCircle")) { var min = a - new int2(r, r); var max = a + new int2(r, r); var actors = world.FindUnits(min, max); var rect = new Rectangle(min.X, min.Y, max.X - min.X, max.Y - min.Y); var inBox = actors.Where(x => x.ExtendedBounds.Value.IntersectsWith(rect)); return(inBox.Where(x => (x.CenterLocation - a).LengthSquared < r * r)); } }