I'm already looking at machines to use this with. This is so cool!
On 11/21/2016 05:53 PM, Jabier Arraiza wrote:
> Is cool you improve it! Im working in a offset LPE currently and hope
> can use this new code soon.
I improved it further the new code is in the *_stable-functions here:
https://github.com/abrock/lib2geom/blob/master/src/toys/ geom-pathstroke.cpp
The old method for offset_cubic:
1. move the control points
2. checked if the error at t=.5 was below some threshold
2. a) if yes return
2. b) otherwise subdivide path and repeat (up to some recursion depth
limit).
The new method:
1. move the control points
2. Find the point on the curve where the distance differs the most from
the desired distance
3. Adjust control point (only lengthes, preserve direction and
smoothness) to minimize this maximum error
4. checked if the error at t=.5 was below some threshold
4. a) if yes return
4. b) otherwise subdivide path and repeat (up to some recursion depth
limit).
This method seems to prevent degradation where the number of nodes
increases exponentially due to numerical instability. Attached are
examples of the old and new method used to repeatedly offset an initial
red curve. The old code produces 4625 segments in the last step, the new
code 3.
Should I prepare a merge request?
I'd like to run some tests, any suggestions which kind? I think the most
important thing is to test for a wide variety of paths if the created
offset path has constant distance from the original path.
Best Regards,
Alexander
------------------------------------------------------------ ------------------
_______________________________________________
Inkscape-devel mailing list
Inkscape-devel@...1656...784...sourceforge.net
https://lists.sourceforge.net/lists/listinfo/inkscape-devel