graphics - efficient algorithm for drawing circle arcs? -


I am using the mid point circle algorithm (Bresenham circle) to attract completely full circles. Is there something similar to attracting circle arc? I would like to specify a starting angle and end angle and only take that part of that circle.

Thanks in advance!

Edit: is to attract a circle arch filled with a pi-slice :)

Do not have some libraries already in your platform that depict these types of shapes?

Attract a full pie-slice:

First of all, cut the pie vertically and horizontally in the quarters. If your pie piece is one of those quarters, or one of these fits in a quarter, then use the following procedure once. Otherwise your pie piece has been cut into pieces - it can also be for some very thin pie-splaccess - repeat the following for each piece.

I am going to describe the pie slice that fits the top quarter - the other quarter is equal to the start and end of the arc pixel (this may require some triggers) . I'm assuming that the "beginning" of this arc in the top-right quarter is on the upper and left sides of the pixel "upper" pixels - if not, then swap them to make it.

Use the Bresenham Circle Algorithm, find all the pixels on the rim of that quarter of the circle, start from the top until you consider the "beginning" pixel - "active" pixels, the rim of the circle But there are points from pixels to pixels points.

Use the Bresenham line algorithm Find the pixel on the "left" row (the line begins with the "beginning" pixel of Arc, and goes straight to the center of the circle).

To attract a horizontal line, for each scan line (every Y-value), draw all the horizontal pixels from the left-hand side of the left-hand to the pixel from the right to the active pixel. Please. (Near the top of the quarter-cycle, there may be several pixels on the rim on the same scan-line Y-value)

Once you control all the active pixels in the circle rim, the remaining triangle Fill, if there is one way: For each scan-line (each y-value), drag a horizontal line from top to bottom, all horizontal pixels from the right-to-left of the right-to-right pixels of the right-line pixels Until covering up, Unless you reach the center of the circle (if the beginning pixel is near the lower part of this quarter-circle, many pixels on the left and the same scan line may be the right row on the Y-value).


Comments

Popular posts from this blog

windows - Heroku throws SQLITE3 Read only exception -

lex - Building a lexical Analyzer in Java -

python - rename keys in a dictionary -