Kuba,
> And here is the trivial porting to bare Qt: no more calling of makesplinepath
> nor strokepath, and we don't depend on existing spline point cache either:
>
> void spline::draw(Context* ctx) const
> {
> ...
> }
>
> Note that we get rid of all spline approximation code, the strokepath,
> transformation of path points, etc. -- that's plenty of code right there
> that goes poof.
Bear in mind that when you have at your disposal a (presumably) efficiently
implemented spline rendering algorithm, your approach makes sense. When you
start with plain X11, which has no spline rendering algorithm at all, my
approach is the proper one, as you want to convert the spline into a segmented
polygonal approximation, and it is preferable to do that calculation when the
shape of the curve changes, not on every redraw. One of the more serious
drawbacks of X11. What I understand least about X11 is how something that
was made to be extensible has remained so incomplete for so long. The
curve-rendering extensions are impossible to use; why couldn't somebody
just implement an XDrawCurve() routine? I think the answer is that those
responsible for maintaining X11 kept too tight a grip on it, and have
probably thereby doomed X11 to eventual extinction. Unfortunately, Tcl/Tk
seems to be heading in the same direction.
> Of course there is a catch: we still need to be able to tell how close
> a point is to a spline, as that is used for pointer hit detection and whatnot.
> I will have to investigate the best way of doing that. A nice hybrid method
> is presented in this paper:
> <ftp://ftp.divms.uiowa.edu/pub/atkinson/CurvesAndSufacesClosestPoint.pdf>
> Robust and Efficient Computation of the Closest Point on a Spline Curve,
> by Wang, Kearney and Atkinson.
It was a helpful byproduct of the linear approximation not to have to come
up with a selection algorithm for curves. I'll leave that one up to you.
---Tim
+--------------------------------+-------------------------------------+
| Dr. R. Timothy Edwards (Tim) | email: [email protected] |
| Open Circuit Design, Inc. | web: http://opencircuitdesign.com |
| 22815 Timber Creek Lane | phone: (301) 528-5030 |
| Clarksburg, MD 20871-4001 | cell: (240) 401-0616 |
+--------------------------------+-------------------------------------+
_______________________________________________
Xcircuit-dev mailing list
[email protected]
http://www.opencircuitdesign.com/mailman/listinfo/xcircuit-dev