arcs/elliptical arcs in path data
Inkscapers,
I just noticed that inkscape uses elliptical arcs in its path data (not if you draw a path, only if you draw an ellipse -- but it uses the <path> element rather than an <ellipse> element I guess because <ellipse> cannot represent rotated ellipses or elliptical arcs.) However, it seems that any sort of union or offset on these ellipses causes them to be converted to bezier curves. (Simplify seems to also convert them.)
Xar only supports bezier curves in the path data, so this would have to be converted. It looks like postscript conversion has a similar issue in that its arcto does not support ellipses.
From the info that I've been able to find, an ellipse can only be
approximated with a quadric bezier curve. Is that correct?
Can anyone please give me some hints as to whether the inkscape source has anything that would be generically usable for converting ellipses to bezier? I've been digging through the source starting with extension/internal/ps-out.cpp and it appears to be leading me to ps.cpp, but I think I missed the conversion.
Thanks, Eric
Eric Wilhelm wrote:
From the info that I've been able to find, an ellipse can only be approximated with a quadric bezier curve. Is that correct?
From everything that I have read too.
Can anyone please give me some hints as to whether the inkscape source has anything that would be generically usable for converting ellipses to bezier? I've been digging through the source starting with extension/internal/ps-out.cpp and it appears to be leading me to ps.cpp, but I think I missed the conversion.
I think inkscape converts svg paths that have elliptical arcs on load too. You might start looking here. http://www.inkscape.org/doc/doxygen/html/svg-path_8cpp.php
Don Lancaster has the most useful stuff about cubic splines I have found so far. He might have something to help you. http://www.tinaja.com/cubic01.asp
I'll keep combing source and sending you pointers until I see someone send you the right answer. :)
Aaron Spike
# from aaron@...749... # on Wednesday 11 January 2006 02:31 pm:
I think inkscape converts svg paths that have elliptical arcs on load too. You might start looking here. http://www.inkscape.org/doc/doxygen/html/svg-path_8cpp.php
I think you may be right. I too have been looking at svg-path.cpp, particularly the rsvg_path_arc() and rsvg_path_arc_segment() functions. While this isn't what I was expecting to find, I think it does indeed contain the approximation code.
BTW, it does convert them once the sodipodi:type="arc" attribute is removed, but not on load: only when you move/modify them (afaict, when the type="arc" attribute is present, move just slaps a transform on it.)
Thanks, Eric
participants (2)
-
unknown@example.com
-
Eric Wilhelm