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

Add visualizer for 2D polygons #1

Open
adamconkey opened this issue Oct 5, 2024 · 2 comments
Open

Add visualizer for 2D polygons #1

adamconkey opened this issue Oct 5, 2024 · 2 comments
Assignees

Comments

@adamconkey
Copy link
Owner

Would like to add some simple support for visualizing 2D polygons. Currently I just draw things on paper and trust that I'm translating them correctly in the code (unit tests), which is error prone and unsatisfying, particularly as the polygons get more complex.

A quick search makes me think egui_plot might be a good option to start with, since it seems to support web-based plotting (important for my server setup) and already has the polygon/line/etc. primitives for visualization. That might be the easiest way to hit the ground running, create converters to generate the needed primitives for the visualization library and then generate from there. Seems that framework also has some basic support for widgets and such which may be really helpful for creating algorithm visualizations.

Ultimately just want something basic to start with, as things progress could try switching to something more impressive.

@adamconkey adamconkey self-assigned this Oct 5, 2024
@adamconkey adamconkey added enhancement New feature or request visualization and removed enhancement New feature or request labels Oct 5, 2024
@adamconkey
Copy link
Owner Author

Still on board with egui_plot at the moment, especially seeing the demo, makes me think it could be a very nice way to host visualizations based on outputs from the test suite. I have to figure out how to get a minimal example running locally first, but my thought is I could setup tests to optionally output visualizations to some standard directory, and then the visualizer would look in there and serve anything it finds. And then in the web app you'll be able to browse the visualizations in some semi-interactive way.

@adamconkey
Copy link
Owner Author

Basic demo of plotting a polygon working on branch feature/add_basic_plotting with egui_plot. I took their demo code and pared it down to a minimal version that support plotting polygons. Though I realize now they only support convex polygons, so I'll likely have to roll my own using more primitive visualizations, composing points and line segments to show the whole polygon boundary. Though for triangulations maybe I can still leverage the egui_plot built-ins since each triangle will be convex.

Need to take one of my actual test polygons that's non-convex and work on building a visualization for it. Then need to figure out how to get the test outputs saved and then loaded into the visualizer, and then also how to scale the GUI navigation for adding arbitrary plots to browse through, not sure if they have something like a file explorer already supported?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

When branches are created from issues, their pull requests are automatically linked.

1 participant