Get all points in circle

BlitzMax Forums/BlitzMax Programming/Get all points in circle

Put MouseX() and MouseY() outside of the inner For loop otherwise you are polling for mouse values via a function call for every pixel.

Local rXm:Float=MouseX()
Local rYm:Float=MouseY()
For b=0 .....

Also your first loop, mentioning the pensize, does not specify the `step` in which that loop will proceed. Perhaps the default of 1.0 is used provided the pensize is big enough to be at least 1 pixel or more? I just wondered if you were causing floating point steps which could be way small causing many more loops than you need.

I think the way I'd do it is use an entirely integer-based bresenham-style circle routine with a diameter of pensize/2, where you have control over being able to iterate through every pixel by yourself without repeating pixels. At the same time I would have a second circle being calculated, simultaneously, at the smaller diameter -(pensize/2) and then only accept pixels that are IN the bigger circle and NOT IN the smaller circle. You can easily find that because you will render the circle one row at a time and only have to figure out the outside radius position of each circle, once - you then only need to pay attention to the pixels on the same row between the outer circle perimeter and the inner one, which are all nicely next to each other in little sequences. You end up `drawing` a hollow circle with a varying pen thickness.

See my fast integer totally non-trigonometry non-floating-point bresenham circle program(s) in the code archives as a basis to work from. I think that will be faster than using any lookup table of sin/cos and you will be sure to cover all pixels, not leaving any gaps and not visiting the same pixel more than once, which is important if you want to use it to draw stuff in lightblend and not have overlap.