add arcTolerance configuration option

This commit is contained in:
bakedpotatolord 2025-06-04 15:55:30 -06:00
commit bc8e6decc8
4 changed files with 11 additions and 7 deletions

View file

@ -97,6 +97,7 @@
"top": false
}],
"camTrueShadow": false,
"camArcTolerance": 0.01,
"camDrillMark": true,
"camPocketSpindle": 1000,
"camPocketTool": 1665454124874,

View file

@ -96,6 +96,7 @@ function prepEach(widget, settings, print, firstPoint, update) {
easeAngle = process.camEaseAngle,
depthFirst = process.camDepthFirst,
engageFactor = process.camFullEngage,
arcTolerance = process.camArcTolerance,
tolerance = 0,
drillDown = 0,
drillLift = 0,
@ -726,8 +727,8 @@ function prepEach(widget, settings, print, firstPoint, update) {
* @returns {Point} - the last point of the polygon
*/
function polyEmit(poly, index, count, fromPoint) {
const arcDist = 0.05, // allowable distance between circle centers
arcRes = 8, //8 degs max
//arcTolerance is the allowable distance between circle centers
let arcRes = 8, //8 degs max
arcMax = Infinity; // no max arc radius
fromPoint = fromPoint || printPoint;
@ -783,7 +784,7 @@ function prepEach(widget, settings, print, firstPoint, update) {
// console.log("start",point,lastp)
let dist = lastp? point.distTo2D(lastp) : 0;
if (lastp) {
if (dist >arcDist && lastp) {
if (dist >arcTolerance && lastp) {
let rec = Object.assign(point,{dist});
arcQ.push(rec);
let desp = false; // do arcQ[0] and rec have differing move speeds?
@ -835,9 +836,9 @@ function prepEach(widget, settings, print, firstPoint, update) {
dc = Math.hypot(dx, dy); // delta center distance
}
// if new point is off the arc
// if (deem || depm || desp || dc > arcDist || cc.r < arcMin || cc.r > arcMax || dist > cc.r) {
if ( desp || dc * arcQ.center.length / arcQ.rSum > arcDist || dist > cc.r || cc.r > arcMax || radFault ) {
// let debug = [deem, depm, desp, dc * arcQ.center.length / arcQ.rSum > arcDist, dist > cc.r, cc.r > arcMax, radFault];
// if (deem || depm || desp || dc > arcTolerance || cc.r < arcMin || cc.r > arcMax || dist > cc.r) {
if ( desp || dc * arcQ.center.length / arcQ.rSum > arcTolerance || dist > cc.r || cc.r > arcMax || radFault ) {
// let debug = [deem, depm, desp, dc * arcQ.center.length / arcQ.rSum > arcTolerance, dist > cc.r, cc.r > arcMax, radFault];
// console.log("point off the arc,",structuredClone(arcQ),);
if (arcQ.length === 4) {
// not enough points for an arc, drop first point and recalc center
@ -889,7 +890,7 @@ function prepEach(widget, settings, print, firstPoint, update) {
function drainQ() {
if (!arcDist) {
if (!arcTolerance) {
return;
}
if (arcQ.length > 4) {

View file

@ -578,6 +578,7 @@ const conf = exports({
outputInvertY: false,
camExpertFast: false,
camTrueShadow: false,
camArcTolerance: 0.05,
camForceZMax: false,
camFirstZMax: false,
camToolInit: true,

View file

@ -1281,6 +1281,7 @@ gapp.register("kiri.init", (root, exports) => {
_____: newGroup(LANG.op_xprt_s, $('cam-expert'), { group:"cam_expert", modes:CAM, marker: false, driven, separator }),
camExpertFast: newBoolean(LANG.cx_fast_s, onBooleanClick, {title:LANG.cx_fast_l, show: () => !ui.camTrueShadow.checked }),
camTrueShadow: newBoolean(LANG.cx_true_s, onBooleanClick, {title:LANG.cx_true_l, show: () => !ui.camExpertFast.checked }),
camArcTolerance: newInput(LANG.ad_arct_s, {title:LANG.ad_arct_l, convert:toFloat, bound:bound(0,100)}),
/** LASER/DRAG/WJET/WEDM cut tool Settings */