Improve triangle mesh (splitting of quads based on angle).
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.
This commit is contained in:
parent
23dfd97285
commit
70ec7cc257
@ -482,7 +482,11 @@ void SPolygon::UvGridTriangulateInto(SMesh *mesh, SSurface *srf) {
|
||||
if (this_flag) {
|
||||
// Add the quad to our mesh
|
||||
srf->TangentsAt(us,vs, &tu,&tv);
|
||||
if (tu.Dot(tv) < 0.0) { //split the other way if angle>90
|
||||
if(tu.Dot(tv) < LENGTH_EPS) {
|
||||
/* Split "the other way" if angle>90
|
||||
compare to LENGTH_EPS instead of zero to avoid alternating triangle
|
||||
"orientations" when the tangents are orthogonal (revolve, lathe etc.)
|
||||
this results in a higher quality mesh. */
|
||||
STriangle tr = {};
|
||||
tr.a = a;
|
||||
tr.b = b;
|
||||
|
Loading…
Reference in New Issue
Block a user