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

Investigate artifacts in triangulation for IPA polygons #17

Closed
adamconkey opened this issue Dec 21, 2024 · 4 comments · Fixed by #26
Closed

Investigate artifacts in triangulation for IPA polygons #17

adamconkey opened this issue Dec 21, 2024 · 4 comments · Fixed by #26
Assignees
Labels
bug Something isn't working visualization

Comments

@adamconkey
Copy link
Owner

I noticed in the visualizer for the IAP polygons added in #2 that there are some artifacts that look like long spectral lines, e.g. left-middle here:

Screen Shot 2024-12-21 at 6 22 01 PM

I'm unsure yet if it's an issue with the triangulation (e.g. a degeneracy), if the input polygon is somehow poorly specified (e.g. breaking an assumption like no collinear), or if there is something strange going on in the visualization itself. Will need to investigate a bit to figure out the root cause.

This manifests in several of the visualizations, I only included one as an example.

@adamconkey adamconkey added bug Something isn't working visualization labels Dec 21, 2024
@adamconkey adamconkey self-assigned this Dec 21, 2024
@adamconkey
Copy link
Owner Author

Should also validate the order of the vertices that nothing strange is going on there, since I do assume that the vertices are specified in order (and ideally counter-clockwise order which I assumed for the ones I custom-created).

@adamconkey
Copy link
Owner Author

I did notice in implementing #24 that some of the IAP polygons have collinear points. I'm unsure if that's contributing to the artifacts, but it's possible. I initially was going to disallow any 3 adjacent points from being collinear in the chain since the middle point could be deleted and not affect the geometry of the polygon itself, but decided against it because it's a natural thing that will come up in the process of triangulations. i.e. if you have a polygon with no collinear triples and then remove an ear, it's possible the trimmed polygon then has a collinear triple, and we want that to be allowed.

So, worth looking into if the artifacts could be caused by the collinear points. If so could resolve in the visualization to just not visualize any that cause problems, or could enforce the nominal original polygon to not have collinear triples.

@adamconkey
Copy link
Owner Author

Discovered this is actually a known issue in egui! See emilk/egui_plot#36 and emilk/egui#1226.

I did a few validations on the triangulations to ensure there weren't any degenerate ones with collinear points (which was my hunch), they were all fine. If you look in the visualizer it seems the artifacts are associated with very obtuse triangles, so they are very long and thin and almost look like a straight line until you zoom in and see they have some height definition.

I would still like to include them in the visualization if possible, it would seem a little strange to just arbitrarily not draw some, though if it is only these really thin ones then you likely wouldn't notice. I will play around with some of the workarounds suggested in emilk/egui_plot#36 and see if maybe that resolves it.

@adamconkey adamconkey changed the title Investigate artifacts in triangulation for IAP polygons Investigate artifacts in triangulation for IPA polygons Jan 2, 2025
@adamconkey adamconkey linked a pull request Jan 2, 2025 that will close this issue
@adamconkey
Copy link
Owner Author

Here's a before/after comparison for one of them.

Before:
Screen Shot 2025-01-01 at 11 24 44 AM

After:
Screen Shot 2025-01-01 at 11 25 12 AM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working visualization
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant