Improvements of admesh robustness when loading and fixing STLs.

https://github.com/prusa3d/Slic3r/issues/33
This commit is contained in:
bubnikv 2016-11-16 10:33:23 +01:00
parent d1d6e907c5
commit 52de3940fe
3 changed files with 94 additions and 97 deletions

View file

@ -284,20 +284,6 @@ stl_read(stl_file *stl, int first_facet, int first) {
stl->error = 1;
return;
}
#if 0
// Report close to zero vertex coordinates. Due to the nature of the floating point numbers,
// close to zero values may be represented with singificantly higher precision than the rest of the vertices.
// It may be worth to round these numbers to zero during loading to reduce the number of errors reported
// during the STL import.
for (size_t j = 0; j < 3; ++ j) {
if (facet.vertex[j].x > -1e-12f && facet.vertex[j].x < 1e-12f)
printf("stl_read: facet %d.x = %e\r\n", j, facet.vertex[j].x);
if (facet.vertex[j].y > -1e-12f && facet.vertex[j].y < 1e-12f)
printf("stl_read: facet %d.y = %e\r\n", j, facet.vertex[j].y);
if (facet.vertex[j].z > -1e-12f && facet.vertex[j].z < 1e-12f)
printf("stl_read: facet %d.z = %e\r\n", j, facet.vertex[j].z);
}
#endif
} else
/* Read a single facet from an ASCII .STL file */
{
@ -319,6 +305,21 @@ stl_read(stl_file *stl, int first_facet, int first) {
}
}
#if 0
// Report close to zero vertex coordinates. Due to the nature of the floating point numbers,
// close to zero values may be represented with singificantly higher precision than the rest of the vertices.
// It may be worth to round these numbers to zero during loading to reduce the number of errors reported
// during the STL import.
for (size_t j = 0; j < 3; ++ j) {
if (facet.vertex[j].x > -1e-12f && facet.vertex[j].x < 1e-12f)
printf("stl_read: facet %d.x = %e\r\n", j, facet.vertex[j].x);
if (facet.vertex[j].y > -1e-12f && facet.vertex[j].y < 1e-12f)
printf("stl_read: facet %d.y = %e\r\n", j, facet.vertex[j].y);
if (facet.vertex[j].z > -1e-12f && facet.vertex[j].z < 1e-12f)
printf("stl_read: facet %d.z = %e\r\n", j, facet.vertex[j].z);
}
#endif
#if 1
{
// Positive and negative zeros are possible in the floats, which are considered equal by the FP unit.