fix obviously flawed poly2poly distance weightings affecting cam path output

This commit is contained in:
Stewart Allen 2020-11-01 21:39:34 -05:00
commit be4519410e
2 changed files with 5 additions and 3 deletions

View file

@ -980,7 +980,7 @@
* to be more like outputOrderClosest() and have the option to account for
* depth in determining distance
*/
function poly2polyEmit(array, startPoint, emitter, mark) {
function poly2polyEmit(array, startPoint, emitter, mark, weight) {
let mindist, dist, found, count = 0, marker = mark || 'delete';
for (;;) {
found = null;
@ -1005,7 +1005,9 @@
}
let area = poly.area();
poly.forEachPoint(function(point, index) {
dist = startPoint.distTo3D(point) * area * area;
dist = weight ?
startPoint.distTo3D(point) * area * area :
startPoint.distTo2D(point);
if (dist < mindist) {
found = {poly:poly, index:index, point:point};
mindist = dist;

View file

@ -683,7 +683,7 @@
}
}
});
});
}, null, true);
print.addPrintPoints(preout, layerout, null);