make flatness configurable to fix sphere clipping in contours

This commit is contained in:
Stewart Allen 2022-07-12 16:57:46 -04:00
commit f5e84cfd41
4 changed files with 8 additions and 2 deletions

View file

@ -31,6 +31,7 @@ class Topo {
contourY = axis === "y",
bounds = widget.getBoundingBox().clone(),
tolerance = contour.tolerance,
flatness = contour.flatness || 0.005,
proc = settings.process,
shadow = tshadow,
minX = bounds.min.x,
@ -145,7 +146,7 @@ class Topo {
function push_point(x,y,z) {
const newP = newPoint(x,y,z);
// todo: merge co-linear, not just co-planar
if (lastP && Math.abs(lastP.z - z) < 0.005) {
if (lastP && Math.abs(lastP.z - z) < flatness) {
if (curvesOnly) {
end_poly();
} else {