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

Meshing issue in cylinder #225

Closed
Wulfsta opened this issue Dec 29, 2024 · 7 comments
Closed

Meshing issue in cylinder #225

Wulfsta opened this issue Dec 29, 2024 · 7 comments
Labels
bug Something isn't working

Comments

@Wulfsta
Copy link
Contributor

Wulfsta commented Dec 29, 2024

I am encountering an issue in a mesh generated over a cylinder. See the following screenshot of the exported STL:

meshing_error

What information do you need from me to debug this? I could point you at the example sphere in WeekendSlicer (you can actually see this error in the image in the README), but asking you to look there is not a good way to replicate. I don't see Serde on the Tree or Settings to provide these as data. It might not be trivial to produce a piece of code that will replicate this, due to the amount of floating point math done prior to meshing...

@Wulfsta
Copy link
Contributor Author

Wulfsta commented Dec 30, 2024

This brings up an interesting idea - can meshing be checked via fuzz testing like this? Perform the following:

  • Generate some arbitrary tree.
  • Intersect this tree with some half plane.
  • Evaluate all points that lie on the edge path of that half plane by plugging them into the original tree, and ensure they are zero with some epsilon of error.
  • Save any cases that do not satisfy this condition for further evaluation.

@mkeeter
Copy link
Owner

mkeeter commented Dec 30, 2024

serde::Serialize is derived on VmData, so you could serialize it (I typically use bincode) and add it to the issue. That's the raw tape being evaluated, so it should be mostly reproducible 🤞🏻 if you also provide the render config (bounds / resolution) .

Mesh fuzzing is definitely possible, but robust meshing is a very hard problem, so I fear that fuzzing would find more issues that we could resolve 😅

For example, there are adversarial cases where you can build a model that will always fail to capture sharp features correctly.

@mkeeter mkeeter added the bug Something isn't working label Dec 30, 2024
@Wulfsta
Copy link
Contributor Author

Wulfsta commented Dec 31, 2024

Okay, hopefully this works to replicate! Included in this archive is the STL, the VmData serialized using bincode, and a text file for settings.
bad_cylinder.zip

For example, there are adversarial cases where you can build a model that will always fail to capture sharp features correctly.

I had no idea about this, pretty interesting!

@Wulfsta
Copy link
Contributor Author

Wulfsta commented Jan 9, 2025

Hey @mkeeter, was the data I provided useful in root causing this? Just want to follow up in case you need more information.

@mkeeter
Copy link
Owner

mkeeter commented Jan 9, 2025

I haven't had time to check it out, but the ZIP files look like they should be sufficient – thanks!

@Wulfsta
Copy link
Contributor Author

Wulfsta commented Jan 9, 2025

If you have any questions about how it was generated, this branch has the code I used.

@mkeeter mkeeter mentioned this issue Jan 11, 2025
mkeeter added a commit that referenced this issue Jan 11, 2025
This fixes the spikes of #231 and notch in #225

Unfortunately, it requires careful hand-tuning of parameters, so there
may still be cases that it doesn't handle.
@mkeeter
Copy link
Owner

mkeeter commented Jan 11, 2025

This specific case should be fixed by #232, let me know if you find others.

@mkeeter mkeeter closed this as completed Jan 11, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants