I
I
idg_dima2013-05-19 12:06:11
Algorithms
idg_dima, 2013-05-19 12:06:11

Help finding an ellipse rasterization algorithm

I just can't find a clear explanation of the rasterization algorithm for a filled ellipse, preferably with anti-aliasing. The only article on this topic that I found was extremely difficult for me in mathematical terms and it was only about a circle, the ellipse had something like “it is made in the likeness of a circle, so we leave the derivation of the algorithm to readers as a task.”
On one site I saw a mention of the Wu algorithm, they say it is the coolest and fastest for these purposes, but the description of the algorithm itself could not be found. Wikipedia only has Wu's algorithm for a line.

Answer the question

In order to leave comments, you need to log in

4 answer(s)
I
idg_dima, 2013-05-19
@idg_dima

Succeeded!
I found the main part of the Wu Algorithm code here: create.stephan-brumme.com/antialiased-circle/
I had to do the filling with a uniform color myself. Especially for a long time I struggled with translucency - some pixels were processed 2 times during shading, due to which they became less transparent. But in the end, we managed to do it with one pass over each pixel!

What does it look like

A
Andrey Apanasik, 2013-05-19
@Suvitruf

I once saw something like this on alglib.sources.ru , but for some reason now I don’t have it.
But, if you dig into the archive, then:
Wu's algorithm for rasterizing a circle with antialiasing
Wu's algorithm for rasterizing an ellipse with antialiasing
It?

T
turboNOMAD, 2013-05-19
@turboNOMAD

Drawing an ellipse is very easy.
We go line by line, for each line X is known, we solve the equation of the ellipse with respect to Y. We
get two roots, these are the left and right borders of the line to be filled on line X.
Just remember that these coordinates (X, Y) are calculated taking the center of the ellipse as the origin .
Those. before drawing a line, we add to them (X0, Y0) - the center of the ellipse.

L
lesobrod, 2013-05-19
@lesobrod

If gradient rasterization is supposed, then there is room for creativity.
After all, you can draw a gradient from the center to the contour (the simplest case),
you can from the segment connecting the tricks.
And it is possible from focuses separately. It will be very beautiful, but probably difficult.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question