In article <1fc9a269-4847-4d29-a35e-5cf91731e...@googlegroups.com>, Robert Voigtländer <r.voigtlaen...@gmail.com> wrote:
> Thanks a lot for the links. > > I don't need it to be drawn. I need the fields within the arc for some > statistical calculations for an occupancy map. > So the target is a 2D array, not a picture. > > Robert If you go with one of the suggestions to use a graphics package to draw the arc, you can then take the resulting bitmap image and iterate over it to see which pixels are black and which are white. But, I'm wondering about your comment that, "Using trigonometry is too expensive". Trig is cheaper than you think, because it's all done down in the C libraries, and I wouldn't be surprised if it's not pushed all the way down to the hardware on most modern machines. Compared to your Python application code, I suspect the amount of trig needed for this problem isn't going to be a major factor in timing. Are you guessing that trig is too slow, or have you actually done some profiling to measure whether it is or not? What's the resolution required? Let's assume a 1k x 1k image with the sensor in the center and you need 1 degree angular resolution. There's about 2200 pixels in each 1-degree sector. You could pre-compute those and store 360 sets of 2200 pixels each (about 800k points total). For any given 30 degree sector, just "or" together the 30 1-degree slices and you've got your set of pixels for that sector. Will it be fast enough? Beats me, but it's easy to test.
-- https://mail.python.org/mailman/listinfo/python-list