bucket max parameter, bucket array fix, notes
This commit is contained in:
parent
df8feb8ae7
commit
ecb7ab553e
3 changed files with 10 additions and 8 deletions
3
notes.md
3
notes.md
|
|
@ -57,7 +57,8 @@
|
||||||
* `B` auto bed resizing leaves the origin in the wrong place at first
|
* `B` auto bed resizing leaves the origin in the wrong place at first
|
||||||
* `B` re-add progress calls for all work units
|
* `B` re-add progress calls for all work units
|
||||||
|
|
||||||
* `F` test and enable arcs in belt moe
|
* `F` promote forced layer retraction to a range parameter
|
||||||
|
* `F` test and enable arcs in belt more
|
||||||
* `F` refactor brims to be generated at slice time
|
* `F` refactor brims to be generated at slice time
|
||||||
* `F` anchors should be generated anywhere needed in the print, not just head
|
* `F` anchors should be generated anywhere needed in the print, not just head
|
||||||
* `F` slightly angle supports to lean into the Z of the part
|
* `F` slightly angle supports to lean into the Z of the part
|
||||||
|
|
|
||||||
|
|
@ -38,7 +38,8 @@
|
||||||
zScale, // bucket span in z units
|
zScale, // bucket span in z units
|
||||||
zSum = 0.0, // sanity check that points enclose non-zere volume
|
zSum = 0.0, // sanity check that points enclose non-zere volume
|
||||||
buckets = [], // banded/grouped faces to speed up slice/search
|
buckets = [], // banded/grouped faces to speed up slice/search
|
||||||
bucketMax = options.overlap || 0.75,
|
overlapMax = options.overlap || 0.75,
|
||||||
|
bucketMax = options.bucketmax || 100,
|
||||||
onupdate = options.onupdate || function() {},
|
onupdate = options.onupdate || function() {},
|
||||||
sliceFn = dval(options.slicer, sliceZ),
|
sliceFn = dval(options.slicer, sliceZ),
|
||||||
{ debug, flat, autoDim } = options,
|
{ debug, flat, autoDim } = options,
|
||||||
|
|
@ -120,7 +121,7 @@
|
||||||
let zSpan = zMax - zMin;
|
let zSpan = zMax - zMin;
|
||||||
let zSpanAvg = zSum / points.length;
|
let zSpanAvg = zSum / points.length;
|
||||||
let bucketCount = options.bucket !== false ?
|
let bucketCount = options.bucket !== false ?
|
||||||
Math.max(1, Math.floor(zSpan / zSpanAvg)) : 1;
|
Math.min(bucketMax, Math.max(1, Math.floor(zSpan / zSpanAvg))) : 1;
|
||||||
|
|
||||||
zScale = 1 / (zSpan / bucketCount);
|
zScale = 1 / (zSpan / bucketCount);
|
||||||
|
|
||||||
|
|
@ -138,12 +139,12 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
// create empty buckets
|
// create empty buckets
|
||||||
for (i = 0; i < bucketCount + 1; i++) {
|
for (i = 0; i < bucketCount; i++) {
|
||||||
buckets.push({ points: [], slices: [] });
|
buckets.push({ points: [], slices: [] });
|
||||||
}
|
}
|
||||||
|
|
||||||
if (bucketCount > 1) {
|
if (bucketCount > 1) {
|
||||||
let failAt = (points.length * bucketMax) | 0, bucket;
|
let failAt = (points.length * overlapMax) | 0, bucket;
|
||||||
// copy triples into all matching z-buckets
|
// copy triples into all matching z-buckets
|
||||||
outer: for (i = 0; i < points.length;) {
|
outer: for (i = 0; i < points.length;) {
|
||||||
p1 = points[i++];
|
p1 = points[i++];
|
||||||
|
|
@ -177,7 +178,8 @@
|
||||||
|
|
||||||
// create buckets data structure
|
// create buckets data structure
|
||||||
for (let z of zIndexes) {
|
for (let z of zIndexes) {
|
||||||
let index = bucketCount > 1 ? Math.floor((z - zMin) * zScale) : 0;
|
let index = bucketCount <= 1 ? 0 :
|
||||||
|
Math.min( Math.floor((z - zMin) * zScale), bucketCount - 1 );
|
||||||
buckets[index].slices.push(z);
|
buckets[index].slices.push(z);
|
||||||
onupdate((i / zIndexes.length) * 0.1);
|
onupdate((i / zIndexes.length) * 0.1);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -176,10 +176,9 @@
|
||||||
if (concurrent > 1) {
|
if (concurrent > 1) {
|
||||||
if (bucketCount < concurrent) {
|
if (bucketCount < concurrent) {
|
||||||
bucketCount = concurrent;
|
bucketCount = concurrent;
|
||||||
} else if (bucketCount > 100) {
|
|
||||||
bucketCount = 100;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
bucketCount = Math.min(bucketCount, 100);
|
||||||
|
|
||||||
zScale = 1 / (zMax / bucketCount);
|
zScale = 1 / (zMax / bucketCount);
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue