fast algorithm for drawing filled circles?

前端 未结 10 1140
清歌不尽
清歌不尽 2020-12-02 07:28

I am using Bresenham\'s circle algorithm for fast circle drawing. However, I also want to (at the request of the user) draw a filled circle.

Is there a fast and effi

10条回答
  •  不思量自难忘°
    2020-12-02 08:13

    Having read the Wikipedia page on Bresenham's (also 'Midpoint') circle algorithm, it would appear that the easiest thing to do would be to modify its actions, such that instead of

    setPixel(x0 + x, y0 + y);
    setPixel(x0 - x, y0 + y);
    

    and similar, each time you instead do

    lineFrom(x0 - x, y0 + y, x0 + x, y0 + y);
    

    That is, for each pair of points (with the same y) that Bresenham would you have you plot, you instead connect with a line.

提交回复
热议问题