-1

I need to quickly set all pixels in a circle (x0,y0,r) to solid or empty on a big, per-pixel map. Like in worms or liero game when you blow up terrain with a bomb.

I considered quad tree and simple 2d array, but quad tree seems bad for adding/removing circles, and simple 2d array takes up a lot of memory for big maps

Is there some better algorithm that could make this fast and small?

ajuc
  • 590
  • 6
  • 12
  • What are you going to do with these data? – MBo Dec 22 '14 at 09:52
  • Draw terrain (background texture for empty pixels, foreground texture for solid pixels), and do collision detection for 2 players and their bullets with these pixels. – ajuc Dec 22 '14 at 10:05

1 Answers1

0

You can try a quadkey. Translate the points to a binary and interleave it. Treat it as base 4 number. It used in bing maps for the tiles of the map.

Micromega
  • 12,486
  • 7
  • 35
  • 72