Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

epaint: Add EllipseShape #4122

Merged
merged 10 commits into from Mar 20, 2024
Merged

epaint: Add EllipseShape #4122

merged 10 commits into from Mar 20, 2024

Conversation

TheTacBanana
Copy link
Contributor

@TheTacBanana TheTacBanana commented Mar 2, 2024

Adds an Ellipse shape draw-able with the Painter, brings egui closer to the SVG Specification.

I've done some optimization towards using less vertices and doing less calculations.

Currently the vertices are evenly distributed.
It's possible this could be optimized further taking into account the gradient and increasing the concentration of vertices where the change in gradient is larger.

EllipseTall
EllipseWide

@TheTacBanana
Copy link
Contributor Author

Points are now distributed based on an easing function
Concentrating points around tighter bends, such as if the width if much greater than the height

@TheTacBanana TheTacBanana marked this pull request as ready for review March 3, 2024 13:30
@TheTacBanana TheTacBanana changed the title Add Ellipse Shape to Painter epaint: Add Ellipse Shape Mar 4, 2024
@TheTacBanana TheTacBanana changed the title epaint: Add Ellipse Shape epaint: Add Ellipse Shape Mar 4, 2024
crates/epaint/src/shape.rs Outdated Show resolved Hide resolved
@emilk
Copy link
Owner

emilk commented Mar 8, 2024

I appreciate the PR, but I wonder how far we should be taking epaint. The purpose of epaint is to support the painting needs for a GUI, not arbitrary anythings, and certainly not to be on par with SVG. Still, ellipses isn't adding too much code or complexity, so it's probably fine.

But - what are you planning on using this for?

@TheTacBanana
Copy link
Contributor Author

Was using ellipses to draw nodes of graphs, as it looks much better than using either a large circle with label inside or a small circle with label outside
image

Thought that someone else might find it useful in the future

Have changed to radius, definitely makes more sense than size

@emilk emilk added the epaint label Mar 12, 2024
@nowakf
Copy link

nowakf commented Mar 18, 2024

I just ran into this, with the same use case!

@emilk emilk added the egui label Mar 20, 2024
@emilk emilk changed the title epaint: Add Ellipse Shape epaint: Add EllipseShape Mar 20, 2024
@emilk emilk merged commit bce257a into emilk:master Mar 20, 2024
20 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants