Difference between revisions of "Path Library Improvement Project"
m |
|||
Line 7: | Line 7: | ||
# Given a threshold value, break a path into line segments (we call this a polyline) | # Given a threshold value, break a path into line segments (we call this a polyline) | ||
# Fit cubic bezier patches on the polyline such that the total error is controlled and the number of patches are kept minimum. | # Fit cubic bezier patches on the polyline such that the total error is controlled and the number of patches are kept minimum. | ||
=== Breaking up into line segments === | |||
While this process can be very simple if we simply use lib2geom's <code>Geom::Curve</code> abstraction with a recursive path splitting algorithm. I think it's still better to use separate pieces of codes to deal with each type of curve separately. There are two advantages to doing this. Firstly, if you know the curve type, you can use a faster algorithm to do the splitting, secondly we can use the same path splitting algorithms as livarot does and have identical results. | |||
At the moment, I have custom code to deal with Cubic Bezier curves and Line Segments (<code>PathFlattener::breakLine</code> and <code>PathFlattener::breakCubic</code>) and for every other type a generalized function <code>PathFlattener::breakCurve</code> is used. |
Revision as of 08:56, 14 June 2020
This wiki page will hold all extra documentation that I intend to write as I progress in the project.
The first functionality that I have succeeded to implement is Path Simplification.
Path Simplification
It is a two step process:
- Given a threshold value, break a path into line segments (we call this a polyline)
- Fit cubic bezier patches on the polyline such that the total error is controlled and the number of patches are kept minimum.
Breaking up into line segments
While this process can be very simple if we simply use lib2geom's Geom::Curve
abstraction with a recursive path splitting algorithm. I think it's still better to use separate pieces of codes to deal with each type of curve separately. There are two advantages to doing this. Firstly, if you know the curve type, you can use a faster algorithm to do the splitting, secondly we can use the same path splitting algorithms as livarot does and have identical results.
At the moment, I have custom code to deal with Cubic Bezier curves and Line Segments (PathFlattener::breakLine
and PathFlattener::breakCubic
) and for every other type a generalized function PathFlattener::breakCurve
is used.