Crate lyon_bezier [−] [src]
Bezier curve related maths and tools.
This crate implement simple 2d quadratic and cubic bezier math, and an efficient flattening algorithm.
The flatteing algorithm implemented here is the most interesting part. It is based on: http://cis.usouthal.edu/~hain/general/Publications/Bezier/Bezier%20Offset%20Curves.pdf It produces a better approximations than the usual recursive subdivision approach (or in other words, it generates less points for a given tolerance threshold).
Structs
| CubicBezierSegment |
A 2d curve segment defined by four points: the beginning of the segment, two control points and the end of the segment. |
| CubicFlatteningIter |
An iterator over a cubic bezier segment that yields line segments approximating the curve for a given approximation threshold. |
| QuadraticBezierSegment |
A 2d curve segment defined by three points: the beginning of the segment, a control point and the end of the segment. |
| QuadraticFlatteningIter |
An iterator over a quadratic bezier segment that yields line segments approximating the curve for a given approximation threshold. |
Functions
| cubic_to_quadratic |
Approximate a cubic bezier segment with a sequence of quadratic bezier segments. |
Type Definitions
| Point | |
| Vec2 |