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

@ -990,6 +990,7 @@ CAM.init = function(kiri, api) {
rate: 'camContourSpeed',
angle: 'camContourAngle',
tolerance: 'camTolerance',
flatness: 'camFlatness',
curves: 'camContourCurves',
inside: 'camContourIn',
axis: 'X'
@ -1001,7 +1002,8 @@ CAM.init = function(kiri, api) {
step: UC.newInput(LANG.cc_sovr_s, {title:LANG.cc_sovr_l, convert:UC.toFloat, bound:UC.bound(0.01,1.0)}),
rate: UC.newInput(LANG.cc_feed_s, {title:LANG.cc_feed_l, convert:UC.toInt, units:true}),
angle: UC.newInput(LANG.cf_angl_s, {title:LANG.cf_angl_l, convert:UC.toFloat, bound:UC.bound(45,90)}),
tolerance: UC.newInput(LANG.ou_toll_s, {title:LANG.ou_toll_l, convert:UC.toFloat, bound:UC.bound(0,10.0), units:true}),
flatness: UC.newInput(LANG.ou_flat_s, {title:LANG.ou_flat_l, convert:UC.toFloat, bound:UC.bound(0,1.0), units:true, round:4}),
tolerance: UC.newInput(LANG.ou_toll_s, {title:LANG.ou_toll_l, convert:UC.toFloat, bound:UC.bound(0,10.0), units:true, round:4}),
sep: UC.newBlank({class:"pop-sep"}),
curves: UC.newBoolean(LANG.cf_curv_s, undefined, {title:LANG.cf_curv_l}),
inside: UC.newBoolean(LANG.cf_olin_s, undefined, {title:LANG.cf_olin_l})

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 {

View file

@ -531,6 +531,7 @@ const conf = exports({
camFastFeed: 6000,
camFastFeedZ: 300,
camTolerance: 0,
camFlatness: 0.001,
camStockX: 5,
camStockY: 5,
camStockZ: 0,

View file

@ -596,6 +596,8 @@ self.kiri.lang['en-us'] = {
// OUTPUT CAM
ou_toll_s: "tolerance",
ou_toll_l: ["surface precision","in workspace units","lower is slower and","uses more memory","0 = automatic based","on animate preference"],
ou_flat_s: "flatness",
ou_flat_l: ["delta z below which two adjacent","points are considered co-linear"],
ou_zanc_s: "z anchor",
ou_zanc_l: ["controls the position of the part","when stock Z exceeds part Z"],
ou_ztof_s: "z offset",