[LIBART] collinearity



Howdy --

I'm back with more questions about collinearity and
numerical stability in libart.

To recap, I'm using libart to render hand-drawn strokes
to an image buffer, and then writing that out to a bitmapped
graphics file.

I have seen a lot of strange artifacts (usually what I get
is a horizontal "streak" of pixels running from my vpath to
the right-most edge of the image).  Lauris suggested that
collinearity of points was to blame (which given the nature
of the input was a highly valid suggestion), so I tried to
counter this by perturbing the points in my vpath.

This definitely cut down the frequency of such artifacts,
but it did not completely eliminate it.

I'm now trying to eliminate collinear points using the
"parallelogram area" method of testing for collinearity.
This has helped, too, but I still get these artifacts from
time to time.  Unfortunately, I need this rendering to be
100% reliable.

The algorithm for the collinearity test is detailed here:
http://www.pms.informatik.uni-muenchen.de/lehre/compgeometry/Gosper/computat
ional_geometry_overview/computational_geometry.html

I figured that I couldn't just test to see if the area is
equal to 0, though; instead I check to see if it's within
a range near 0.  I figured that if a point was only a fraction
of a pixel away from being collinear, that libart might have
trouble with it.  So I'm rejecting any points whose parallelogram
area is less than 1.  I suppose that if the parallelogram were
very "wide", a tiny deviation from true collinearity might result
in an area greater than 1, so this method is not foolproof.

Any suggestions on a better way to clean up collinear points?
Failing that, are there libraries better suited to rendering
arbitrary, hand-drawn strokes?

I'm assuming that since there is almost nobody reporting similar
problems on the mailing list that most developers are using libart
for more rectilinear applications (although I would think that the
Gill developers would have similar problems, too).

Thanks for any help!

Jason Priebe
Mi-Co
http://www.mi-corporation.com/





[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]