Gip-Gip / egui-plotter

Simple to use utilties for integrating plotter into egui
MIT License
40 stars 15 forks source link

Fix polygon drawing to allow feathering #19

Open themoritz opened 1 month ago

themoritz commented 1 month ago

This PR makes a change to the polygon drawing function in order to support non-convex polygons. Non-convex polygons caused glitches when feathering was enabled.

The polygons are now drawn by first triangulating it (with a function from the earcutr crate) and then creating a Mesh from the resulting set of triangles.

Feathering can now be enabled and the plots look much nicer:

Before:

Screenshot 2024-05-27 at 09 53 00

After:

Screenshot 2024-05-27 at 09 51 35

The downside is the additional dependency, but I'm not aware of how to support non-convex polygons in another way.

This PR also bumps egui to 0.27.2.