You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
all of these vertexes I think are supposed to be the same, but because of roundoff errors in the 11+th decimal point they end up looking like different vertex, that creates tiny holes in the mesh:
vertex 0.5 -0.5000000000000001 -0.20710678118654358
vertex 0.5 0.2071067811865434 -0.5
vertex 0.5 0.2071067811865434 -0.5
vertex 0.5 0.20710678118654346 -0.5
vertex 0.5 0.2071067811865435 -0.5
vertex 0.5 0.20710678118655118 0.5
vertex 0.5 0.20710678118655124 0.5
vertex 0.5 0.20710678118655135 0.5
vertex 0.5 0.20710678118655135 0.5
vertex 0.5 0.49999999999999983 -0.2071067811865514
vertex 0.5 0.49999999999999983 -0.2071067811865514
vertex 0.5 0.5 -0.20710678118655118
vertex 0.5 0.5 -0.20710678118655118
recommended solution in exporter.js:
function fToStr(f)
{
return (+f).toExponential(11).replace(/0+e/,'e');
}
function AddTriangleToContent (normal, vertex1, vertex2, vertex3)
{
AddLineToContent ('\tfacet normal ' + fToStr(normal.x) + ' ' + fToStr(normal.y) + ' ' + fToStr(normal.z));
AddLineToContent ('\t\touter loop');
AddLineToContent ('\t\t\tvertex ' + fToStr(vertex1.x) + ' ' + fToStr(vertex1.y) + ' ' + fToStr(vertex1.z));
AddLineToContent ('\t\t\tvertex ' + fToStr(vertex2.x) + ' ' + fToStr(vertex2.y) + ' ' + fToStr(vertex2.z));
AddLineToContent ('\t\t\tvertex ' + fToStr(vertex3.x) + ' ' + fToStr(vertex3.y) + ' ' + fToStr(vertex3.z));
AddLineToContent ('\t\tendloop');
AddLineToContent ('\tendfacet');
}
unfortunately this prints "0.5" as "5.e-1" but this is necessary to get the maximum resolution. I did find that toExponential(12) does occasionally still produce an error.
The replace portion is just to remove trailing zeros thus shortening the output.
The text was updated successfully, but these errors were encountered:
all of these vertexes I think are supposed to be the same, but because of roundoff errors in the 11+th decimal point they end up looking like different vertex, that creates tiny holes in the mesh:
vertex 0.5 -0.5000000000000001 -0.20710678118654358
vertex 0.5 0.2071067811865434 -0.5
vertex 0.5 0.2071067811865434 -0.5
vertex 0.5 0.20710678118654346 -0.5
vertex 0.5 0.2071067811865435 -0.5
vertex 0.5 0.20710678118655118 0.5
vertex 0.5 0.20710678118655124 0.5
vertex 0.5 0.20710678118655135 0.5
vertex 0.5 0.20710678118655135 0.5
vertex 0.5 0.49999999999999983 -0.2071067811865514
vertex 0.5 0.49999999999999983 -0.2071067811865514
vertex 0.5 0.5 -0.20710678118655118
vertex 0.5 0.5 -0.20710678118655118
recommended solution in exporter.js:
function fToStr(f)
{
return (+f).toExponential(11).replace(/0+e/,'e');
}
function AddTriangleToContent (normal, vertex1, vertex2, vertex3)
{
AddLineToContent ('\tfacet normal ' + fToStr(normal.x) + ' ' + fToStr(normal.y) + ' ' + fToStr(normal.z));
AddLineToContent ('\t\touter loop');
AddLineToContent ('\t\t\tvertex ' + fToStr(vertex1.x) + ' ' + fToStr(vertex1.y) + ' ' + fToStr(vertex1.z));
AddLineToContent ('\t\t\tvertex ' + fToStr(vertex2.x) + ' ' + fToStr(vertex2.y) + ' ' + fToStr(vertex2.z));
AddLineToContent ('\t\t\tvertex ' + fToStr(vertex3.x) + ' ' + fToStr(vertex3.y) + ' ' + fToStr(vertex3.z));
AddLineToContent ('\t\tendloop');
AddLineToContent ('\tendfacet');
}
unfortunately this prints "0.5" as "5.e-1" but this is necessary to get the maximum resolution. I did find that toExponential(12) does occasionally still produce an error.
The replace portion is just to remove trailing zeros thus shortening the output.
The text was updated successfully, but these errors were encountered: