# Using Bresenham's circle algorithm (or another alternative algorithm) to draw an arc [closed]

I'm trying to create some graphics function for a ZX Spectrum (Z80) machine in assembler. I already have the basics except for the arc.

I know that there must be some way to draw an arc using the Bresenham's circle algorithm but I'm unable to find concrete info about it, there are sentences like "set the pixels only if they fall into the wanted interval" but I have no clue on how to determine if the pixels fall within it.

As data I have the circle's center and radius and the start and end points of the arc in the circle, I only miss how to determine if a pixel lies in the arc, if the algorithm were completely linear (start at 0º and sweep to 360º) it would be easy to do not draw until the start point is reached and then continue drawing until the last point is reached, but the Bresenham's algorithm is drawn in octants simultaneously so I have no idea on how to do it.

I'm not tied to anything so any other algorithm would be welcome, no need to be specifically for the spectrum, just any assembler algorithm to draw an arc will be enough, even if I need different info (like the three point arc algorithm).

Cheers.

• @MartinMaly: They require no multiplies or divides, at least not in the loop. The symmetry is an extra bonus that you would either ditch, or would complicate it for an arc. Jun 9, 2020 at 6:00
• @Wilson I am using the ROM function from assembler but it's painfully slow, the implementation in the Spectrum ROM uses the calculator stack to compute the arc using internally a lot of floating point operations and that's what i'm trying to avoid. Jun 9, 2020 at 6:09
• @Wilson: The Spectrum's Basic circle-drawing algorithm does not use Breseham's algorithm. They seem not to have been aware of it. The use a much slower method resulting in much more lumpy circles that I assume is based on the ROM's trig functions. Jun 9, 2020 at 7:01
• @Gusman since this isn't retro-specific and it's already getting negative votes I'm going to suggest it get moved to computergraphics SE. Tweak your wording to ask for an integer or fixed-point solution. Note that two circles (or none) will satisfy crossing through two points with a given radius. Jun 9, 2020 at 7:18
• I’m voting to close this question because it belongs on computergraphics.stackexchange.com Jun 9, 2020 at 7:19