Antialiasied bezier curves - how?

Does anyone know a good source of antialiasing code?

I’m using a non-optimized version in my code, but with the amount of lines
I’m drawing it seems to get quite slow.

What I do right now is I split the bezier curve into a number of line
segments and draw each line using antialiasing. But that doesn’t look right
in some situations …

–Jens

Does anyone know a good source of antialiasing code?

I’m using a non-optimized version in my code, but with the amount of lines
I’m drawing it seems to get quite slow.

What I do right now is I split the bezier curve into a number of line
segments and draw each line using antialiasing. But that doesn’t look right
in some situations …

–Jens

I decided to consult “Computer Graphics: Principals and
Practice” Foley-vanDam-Feiner-Hughes WRT your question.
They discuss anti-aliasing curves around page 971-976.
If you are ambitious you may wish to consult this. I
did not find much related specifically to anti-aliasing
Benzier curves, however. I did check out around page 508-
514 where drawing (non-antialiased) curves are discussed.
It suggested that Benzier curves were particularly suited
for drawing by subdividing into line-segments. In this
section they suggest computing the maximum deviation of
the curve from a line between the curve’s endpoints, and
if the maximum deviation is less than a maximum allowable
deviation (epsilon), draw the curve as a line-segment…
otherwise subdivide the curve. It looks like they
are suggesting an epsilon or 1/2 pixel for non-antialiased
curves. I would suspect that an epsilon of 1/8 pixel would
be more suited for antialiased curves. I would also advise
you to be aware of how the line segments are joined and
mixed. I would probably implement this as a single-colored
region where only the alpha varries… Also be careful not
to have the junctions of these line-segments overlap. Often
anti-aliased line routines will be implemented such that the
lines have “endcaps”… (In PostScript, for instance, the
language allows you to specify what type of endcaps
you want square, round, none…) These will cause
unnecessary overlap, and will probably cause dark spots
where these line-segments are joined.

If you need more assistance let me know, but I hope this
will help you.

Regards,

-Loren

P.S. I’m refering to “Computer Graphics: Principals and
Practice” Foley-vanDam-Feiner-Hughes Second Edition, Revised
Fifth Printing


Great news! Get free KNXmail here!
http://www.knx1070.com

Jens Schmidt wrote:

Does anyone know a good source of antialiasing code?

I’m using a non-optimized version in my code, but with the amount of lines
I’m drawing it seems to get quite slow.

What I do right now is I split the bezier curve into a number of line
segments and draw each line using antialiasing. But that doesn’t look right
in some situations …

It depends on the kind of antialiasing you want to produce. One way
would be to make use of an antialiased brush, which is probably the most
general method for performing antialiasing. You get a square array of
pixels, 16 times as dense in each direction as the actual thickness of
the curve, and attempt to oversample the path of your curve 16 times.
It produces very good results and is highly general. See Foley for
details on this, or if you can find it, Turner Whitted’s original
article in SIGGRAPH 83: “Antialiased Line Drawing Using Brush
Extrusion.” However, it’s an image precision method, and as such is
probably less accurate than an actual object-precision method that
attempts to actually determine the actual subpixel geometry of the
underlying curve and shade the pixel accordingly would produce better
results. I’m trying to formulate such an algorithm myself, and i can
say it’s not easy to do. My best efforts have come out all wrong, and
all such object precision methods are by their very nature expensive…–
Rafael R. Sevilla <@Rafael_R_Sevilla> +63 (2) 4342217
Mobile Robotics Laboratory +63 (917) 4458925
University of the Philippines Diliman