mirror of
https://github.com/Doodle3D/Doodle3D-Slicer.git
synced 2024-11-22 05:37:55 +01:00
Merge branch 'develop' into feature/comb
This commit is contained in:
commit
ead6be081f
@ -82,12 +82,12 @@ export default function optimizePaths(slices) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function optimizeShape(shape, start) {
|
function optimizeShape(shape, start) {
|
||||||
const inputPaths = shape.mapToLower();
|
const inputPaths = shape.mapToLower().filter(path => path.length > 0);
|
||||||
const optimizedPaths = [];
|
const optimizedPaths = [];
|
||||||
const donePaths = [];
|
const donePaths = [];
|
||||||
|
|
||||||
while (optimizedPaths.length !== inputPaths.length) {
|
while (optimizedPaths.length !== inputPaths.length) {
|
||||||
let minLength = false;
|
let minLength = Infinity;
|
||||||
let reverse;
|
let reverse;
|
||||||
let minPath;
|
let minPath;
|
||||||
let offset;
|
let offset;
|
||||||
@ -101,7 +101,7 @@ function optimizeShape(shape, start) {
|
|||||||
if (shape.closed) {
|
if (shape.closed) {
|
||||||
for (let j = 0; j < path.length; j += 1) {
|
for (let j = 0; j < path.length; j += 1) {
|
||||||
const length = distanceTo(path[j], start);
|
const length = distanceTo(path[j], start);
|
||||||
if (minLength === false || length < minLength) {
|
if (length < minLength) {
|
||||||
minPath = path;
|
minPath = path;
|
||||||
minLength = length;
|
minLength = length;
|
||||||
offset = j;
|
offset = j;
|
||||||
@ -110,7 +110,7 @@ function optimizeShape(shape, start) {
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
const lengthToStart = distanceTo(path[0], start);
|
const lengthToStart = distanceTo(path[0], start);
|
||||||
if (minLength === false || lengthToStart < minLength) {
|
if (lengthToStart < minLength) {
|
||||||
minPath = path;
|
minPath = path;
|
||||||
minLength = lengthToStart;
|
minLength = lengthToStart;
|
||||||
reverse = false;
|
reverse = false;
|
||||||
|
Loading…
Reference in New Issue
Block a user