add shell width stepping
This commit is contained in:
parent
8dfd40bf69
commit
82a429c13a
1 changed files with 8 additions and 2 deletions
|
|
@ -239,12 +239,15 @@ function trace_noodle(noodle, noodleWidth, minR, midR, maxR, opt = {}) {
|
||||||
showMedialAxis,
|
showMedialAxis,
|
||||||
showChainIntersect,
|
showChainIntersect,
|
||||||
minArea = midR * midR,
|
minArea = midR * midR,
|
||||||
|
shellStep = 1 / 30, // diameter step as % of nozzle
|
||||||
lines = [],
|
lines = [],
|
||||||
polys = [],
|
polys = [],
|
||||||
remain = [],
|
remain = [],
|
||||||
trace = [],
|
trace = [],
|
||||||
shell = 0
|
shell = 0
|
||||||
} = opt;
|
} = opt;
|
||||||
|
|
||||||
|
let sstep = 1 / shellStep;
|
||||||
let insets = [];
|
let insets = [];
|
||||||
let scale = 1000;
|
let scale = 1000;
|
||||||
let dstep = minR / 4;
|
let dstep = minR / 4;
|
||||||
|
|
@ -482,17 +485,20 @@ function trace_noodle(noodle, noodleWidth, minR, midR, maxR, opt = {}) {
|
||||||
}
|
}
|
||||||
let op;
|
let op;
|
||||||
if (pop.length === 1) {
|
if (pop.length === 1) {
|
||||||
|
// let rad_step = ((pop[0] * sstep) | 0) / sstep;
|
||||||
// for single wall place it exactly on medial axis
|
// for single wall place it exactly on medial axis
|
||||||
nupoly.push(new Point(min.x, min.y));
|
nupoly.push(new Point(min.x, min.y));
|
||||||
trace.push(op = { x: min.x, y: min.y, r: mr, sno })
|
trace.push(op = { x: min.x, y: min.y, r: mr, sno })
|
||||||
} else {
|
} else {
|
||||||
|
// radius rounded to nearest step
|
||||||
|
let rad_step = ((pop[0] * sstep) | 0) / sstep;
|
||||||
// otherwise use first division
|
// otherwise use first division
|
||||||
// compensate for minimal inset
|
// compensate for minimal inset
|
||||||
let off = -dstep + pop[0];
|
let off = -dstep + rad_step;
|
||||||
trace.push(op = {
|
trace.push(op = {
|
||||||
x: np1.x + dy * off,
|
x: np1.x + dy * off,
|
||||||
y: np1.y - dx * off,
|
y: np1.y - dx * off,
|
||||||
r: pop[0],
|
r: rad_step,
|
||||||
sno
|
sno
|
||||||
})
|
})
|
||||||
// trace inset by full diameter
|
// trace inset by full diameter
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue