#bezier #spline #vertices #linestring2bezier

linestring2bezier

For converting geo_types::LineString<T: CoordFloat> to a cubic bezier spline

2 unstable releases

new 0.2.0 May 12, 2025
0.1.0 May 12, 2025

#131 in Geospatial

MIT license

18KB
346 lines

Approximate a geo_types::LineString with a cubic bezier spline

Pass the linestring and a maximum allowed error to BezierString::from_linestring The error is the maximum distance between the linestring and the bezier spline evaulated at the linestring vertices and at the middle point between the vertices


For converting geo_types::LineString<T: CoordFloat> into a piecewise cubic bezier, given as a Vec<BezierSegment<T>>.

BezierSegment<T: CoordFloat> has fields:
start: geo_types::Coord<T>
handles: Option<(geo_types::Coord<T>, geo_types::Coord<T>)>
end: geo_types::Coord<T>

The handles field is None if the segment is a straight line, otherwise the segment is a Cubic Bezier.

Dependencies

~1MB
~19K SLoC