I have a bunch of 2d positions (red dots in the example image) in an array and I want to calculate the number of pixels that the volume of the polygon takes up (the yellow shape). You can see that I only want to calculate a boundary, the interior points would get ignored.
I want to have this calculation done in close to realtime. How would I go about this?
If you are looking to get the amount of pixels precisely then the only way I can think is to:
- Render this screen on a texture (render target)
- Read the pixels from the texture, that will give you an array of RGBA colors.
- Loop through the pixels and find which are yellow.
I don’t have an example in mind but there have been discussions on the forum on how to do 1. and 2. Try a forum search, hope it helps.