Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public static bool FitInCircle(int y, int x, int oY, int oX, int radius2)
- {
- bool ret = false;
- int dX = (oX > x) ? (oX - x) : (x - oX);
- int dY = (oY > y) ? (oY - y) : (y - oY);
- if (dX * dX + dY * dY <= radius2)
- ret = true;
- return ret;
- }
- Doesn't seem to select the same tiles as:
- private void AddPresence(Location point)
- {
- int radius = (int)Math.Round(Math.Sqrt(CollationRadius2), 0, MidpointRounding.AwayFromZero);
- int dY, dX;
- for (int y = -radius - 2; y <= radius + 2; y++)
- for (int x = -radius - 2; x <= radius + 2; x++)
- if (x * x + y * y <= CollationRadius2)
- {
- dY = (point.Y + y) % Smurfer.Height;
- if (dY < 0) dY += Smurfer.Height;
- dX = (point.X + x) % Smurfer.Width;
- if (dX < 0) dX += Smurfer.Width;
- World.Presence[dY, dX]++;
- Presence[dY, dX]++;
- }
- }
Add Comment
Please, Sign In to add comment