flo_curves
flo_curves copied to clipboard
[Question] Walk BezierPath evenly obtaining positions and tangents
I am looking for a way to walk BezierPath evenly to get points and their tangents. I also need to specify initial offset (space). What would be a good approach for this?
There's a function for this: walk_curve_evenly()
. The EvenWalkIterator
it returns has a vary_by()
function that can be used to change the size of the following steps, so that can be used to skip a part at the start of the curve.
This function works using chord lengths (distance between points on the curve rather than the length of the curve itself), however, so it can lose accuracy if the steps are very large or at points where the curvature is very high. An uneven walk of the curve will return more dense points where the curvature is higher, so could be used to mitigate this.
v0.8 of flo_curves adds a flatness()
function that can be used to subdivide curves into approximately straight line segments, which would further mitigate this problem (though I haven't added much yet to the library to use this for specific problems like this)
Thank you. I actually ended with copy_path_flat
as I am using Cairo-rs.