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
Improve triangle mesh (splitting of quads based on angle). #613
Conversation
When checking the dot product of the tangents `tu` and `tv` to decide in which direction to split a quad compare it to to LENGTH_EPS instead of zero to avoid alternating triangle "orientations" when the tangents are orthogonal (revolve, lathe etc.). This improves the quality of the resulting triangle mesh.
It seems to me that |
The "random" split directions are technically OK because they happen on flat quads. This is much nicer looking though. |
On the top surface there is a missing triangle in the lower left. You can tell the edge has a vertex there because the vertical surface triangles connect to it, but the top do not. That seems suspicious. Not related to the PR of course. |
Ofc the problem is exist, but should be solved in a different way. One of the solutions is check distance from centre of two edge variants to actual surface and take variant with minimal distance |
This approach will probably solve #489 |
And probably we should apply this to whole surface triangulation instead of quads. |
@Evil-Spirit Thanks for your input. Maybe I merged this too soon. The goal here was to eliminate the randomness in triangles by using a tiny value other than zero. @ruevs and @whitequark to that end it didn't matter which small constant was used. Better to use the common one rather than allow people to thing the one that is hardly used is somehow more important than it is. I like the idea of checking the distance of the 2 possible midpoints to the surface. It seems like more calculation and may not make a better mesh - your test results and PR are certainly welcome! It will not fix the stair-step effect because that is due to helix-axis line not getting subdivided enough. It might do something useful for the other issue of extra silhouette line, but those are also needed near one end but not across the entire "quad" which is twisted - they are too long, which AFAICT can only be fixed by more subdividing the surface along the radial axis - another problem where the edge being a straight line prevents more subdivision. This is all very interesting to me BTW and I welcome the discussion! |
@phkahler |
I said about circle which can be exactly presented by NURBS. But helicoid surface, unfortunately, can be only approximated by NURBS. |
I noticed it as well - it is suspicious - but I though I should look at it a bit closer and create a simpler test case before opening an issue. |
@ruevs Oh. I'm curious why that happens, but wouldn't worry about it too much. The best solution is to use Delaunay triangulation. Not that it's an easy thing to do, but eventually SS really should have it ;-) |
I have no idea why it happens, debugging it would be...interesting... :-) Previous discussions of Delaunay triangulation |
Was looking at the triangulation code. That was probably just a fluke because it's an ear. I'm thinking the bridge to the hole is near there too. Really getting to understand how it's done, the code is actually very readable. Except maybe when this made me laugh:
|
When checking the dot product of the tangents
tu
andtv
to decide in which direction to split a quad compare it to toLENGTH_EPS
instead of zero to avoid alternating triangle "orientations" when the tangents are orthogonal (revolve, lathe etc.). This improves the quality of the resulting triangle mesh.Before:
After:
Model:
LatheSpline.zip