35 releases (7 stable)
1.0.6 | Oct 23, 2024 |
---|---|
1.0.5 | Dec 26, 2023 |
1.0.4 | Dec 7, 2022 |
1.0.3 | Nov 6, 2022 |
0.10.0 | Mar 1, 2018 |
#580 in Graphics APIs
148,989 downloads per month
Used in 396 crates
(17 directly)
265KB
6.5K
SLoC
lyon::geom
2D geometric primitives on top of euclid.
lyon_geom
can be used as a standalone crate or as part of lyon via the lyon::geom
module.
lib.rs
:
Simple 2D geometric primitives on top of euclid.
This crate is reexported in lyon.
Overview.
This crate implements some of the maths to work with:
- lines and line segments,
- quadratic and cubic bézier curves,
- elliptic arcs,
- triangles.
Flattening
Flattening is the action of approximating a curve with a succession of line segments.
→The tolerance threshold taken as input by the flattening algorithms corresponds to the maximum distance between the curve and its linear approximation. The smaller the tolerance is, the more precise the approximation and the more segments are generated. This value is typically chosen in function of the zoom level.
The figure above shows a close up on a curve (the dotted line) and its linear approximation (the black segments). The tolerance threshold is represented by the light green area and the orange arrow.
Dependencies
~1.5MB
~27K SLoC