# Drawing of an anti aliased circular arc

Hi All,

I’m looking for an algorithm for drawing an anti aliased circular arc.

Are there any pointers or sources of it ?

Thanks in advance

–Armin_______________________________________________________________________
Viren-Scan f?r Ihren PC! Jetzt f?r jeden. Sofort, online und kostenlos.
Gleich testen! http://www.pc-sicherheit.web.de/freescan/?mc=022222

Armin Steinhoff <A-Steinhoff web.de> writes:

I’m looking for an algorithm for drawing an anti aliased circular arc.

Are there any pointers or sources of it ?

The basic idea for 4 to 1 antialiasing is that you draw an image at 4 times the
resolution and then you merge them together by adding the reds, greens, and
blues from each of the 4 adjacent pixels and then shift the result right by 2
bits (to divide the result by four).

Say for example these are your surface pixels:

abcdefg
hijklmn

You would calculuate the color of the first destination pixel by doing
(a+b+h+i)>>2 for the red, green, and blue pixel components individually (or,
better still, use autovectoring in your compiler to do these operations in an
SIMD configuration). Likewise the second pixel in the destination surface would
be (c+d+j+k)>>2 .

Drawing the arc to another surface then super-sampling the anti-alias such
as SamuraiCrow suggested is probably your easiest solution.

If you’ve got a standard iterating arc drawing algorithm, you might be able
to take the error term and use it somehow to generate the partial pixels.
It’d be more difficult than a wu antialiased line, but I imagine something
is possible although the outcome might not be quite what you want.

-WillOn 3/12/07, SamuraiCrow wrote:

Armin Steinhoff <A-Steinhoff web.de> writes:

I’m looking for an algorithm for drawing an anti aliased circular arc.

Are there any pointers or sources of it ?

The basic idea for 4 to 1 antialiasing is that you draw an image at 4
times the
resolution and then you merge them together by adding the reds, greens,
and
blues from each of the 4 adjacent pixels and then shift the result right
by 2
bits (to divide the result by four).

Say for example these are your surface pixels:

abcdefg
hijklmn

You would calculuate the color of the first destination pixel by doing
(a+b+h+i)>>2 for the red, green, and blue pixel components individually
(or,
better still, use autovectoring in your compiler to do these operations in
an
SIMD configuration). Likewise the second pixel in the destination surface
would
be (c+d+j+k)>>2 .

SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org

Hi!

Armin Steinhoff schrieb:

I’m looking for an algorithm for drawing an anti aliased circular arc.

Are there any pointers or sources of it ?

If you are from germany, have a look at the book “Computergrafik”
(Bender/Brill, Hanser Verlag). AFAIR no source code, but a good description
of an anti-aliasing algorithm.

Bye,

Tim

You might be able to adapt the code from SDL_gfx … there is an
aaellipse() routine that could be used possibly with some
draw-supression in the loop based on pre-calculated counters to just
draw an arc. Or, if you are not concerned about speed too much, recode
it using a float based iterator and start/end angles.

Source is here: http://www.ferzkopp.net/joomla/content/view/19/14/

(PS: If you ever get some aaArc code working, it would be a great
addition to SDL_gfx).

Tim Sch?rmann wrote:> Hi!

Armin Steinhoff schrieb:

I’m looking for an algorithm for drawing an anti aliased circular arc.

Are there any pointers or sources of it ?

If you are from germany, have a look at the book “Computergrafik”
(Bender/Brill, Hanser Verlag). AFAIR no source code, but a good description
of an anti-aliasing algorithm.

Bye,

Tim

SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org

Andreas Schiffler schrieb am 12.03.2007 23:52:53:

You might be able to adapt the code from SDL_gfx … there is an
aaellipse() routine that could be used possibly with some
draw-supression in the loop based on pre-calculated counters to just
draw an arc.

OK … I will look into that code.

Or, if you are not concerned about speed too much, recode
it using a float based iterator and start/end angles.

Source is here: http://www.ferzkopp.net/joomla/content/view/19/14/

(PS: If you ever get some aaArc code working, it would be a great
addition to SDL_gfx).

Yes … if my coding looks useful I will release it to the SDL-gfx library.

Many thanks

Armin>

Tim Sch?rmann wrote:

Hi!

Der WEB.DE SmartSurfer hilft bis zu 70% Ihrer Onlinekosten zu sparen!
http://smartsurfer.web.de/?mc=100071&distributionid=000000000066

Tim Sch?rmann schrieb am 12.03.2007 22:18:56:

Hi!

Armin Steinhoff schrieb:

I’m looking for an algorithm for drawing an anti aliased circular arc.

Are there any pointers or sources of it ?

If you are from germany,

Yes. I’m from Germany.

have a look at the book “Computergrafik”
(Bender/Brill, Hanser Verlag). AFAIR no source code, but a good description
of an anti-aliasing algorithm.

Interesting …

Thank You

–Armin

PS: we are using SDL, SDL_gfx with an function block based programming environment (QNX6.3)

http://www.steinhoff-automation.com/DviewSDL.htm_______________________________________________________________________
Viren-Scan f?r Ihren PC! Jetzt f?r jeden. Sofort, online und kostenlos.
Gleich testen! http://www.pc-sicherheit.web.de/freescan/?mc=022222

Hi,

thanks to all responding to the anti aliasing issue.

There are a lot of patented algorthm … so it looks like a mine field =:-]

Hope I will find a good solution …

Regards

Armin

“Will Langford” schrieb am 12.03.2007 21:46:46:> Drawing the arc to another surface then super-sampling the anti-alias such as SamuraiCrow suggested is probably your easiest solution.

If you’ve got a standard iterating arc drawing algorithm, you might be able to take the error term and use it somehow to generate the partial pixels. It’d be more difficult than a wu antialiased line, but I imagine something is possible although the outcome might not be quite what you want.

-Will

On 3/12/07, SamuraiCrow wrote:
Armin Steinhoff <A-Steinhoff web.de> writes:

I’m looking for an algorithm for drawing an anti aliased circular arc.

Are there any pointers or sources of it ?

The basic idea for 4 to 1 antialiasing is that you draw an image at 4 times the
resolution and then you merge them together by adding the reds, greens, and
blues from each of the 4 adjacent pixels and then shift the result right by 2

bits (to divide the result by four).

Say for example these are your surface pixels:

abcdefg
hijklmn

You would calculuate the color of the first destination pixel by doing
(a+b+h+i)>>2 for the red, green, and blue pixel components individually (or,

better still, use autovectoring in your compiler to do these operations in an
SIMD configuration). Likewise the second pixel in the destination surface would
be (c+d+j+k)>>2 .

SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org

SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org

Viren-Scan f?r Ihren PC! Jetzt f?r jeden. Sofort, online und kostenlos.
Gleich testen! http://www.pc-sicherheit.web.de/freescan/?mc=022222

Armin Steinhoff escreveu:

I’m looking for an algorithm for drawing an anti aliased circular arc.

Are there any pointers or sources of it ?

See Anti-Grain Geometry:
http://www.antigrain.com/doc/introduction/introduction.agdoc.html#SUBPIXEL_ACCURACY1

You can even directly plug it into a SDL_Surface.

Notice that AGG isn’t itself a “library”, it’s a collection of
algorithms that you can use to form your own drawing library. It’s
probably overkill if all you need is just draw AA arcs; in that case,
try AGG2D, a simple library built over AGG.—
Daniel K. O.

Thanks you … it’s very useful !

–Armin

“Daniel K. O.” <danielko.listas at gmail.com> schrieb am 15.03.2007 16:07:32:>

Armin Steinhoff escreveu:

I’m looking for an algorithm for drawing an anti aliased circular arc.

Are there any pointers or sources of it ?

See Anti-Grain Geometry:
http://www.antigrain.com/doc/introduction/introduction.agdoc.html#SUBPIXEL_ACCURACY1

You can even directly plug it into a SDL_Surface.

Notice that AGG isn’t itself a “library”, it’s a collection of
algorithms that you can use to form your own drawing library. It’s
probably overkill if all you need is just draw AA arcs; in that case,
try AGG2D, a simple library built over AGG.

Daniel K. O.

SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org

Der WEB.DE SmartSurfer hilft bis zu 70% Ihrer Onlinekosten zu sparen!
http://smartsurfer.web.de/?mc=100071&distributionid=000000000066