mirror of
https://github.com/Doodle3D/Doodle3D-Slicer.git
synced 2025-04-04 10:53:40 +02:00
36 lines
965 B
JavaScript
36 lines
965 B
JavaScript
import * as THREE from 'three.js';
|
|
import { PRECISION } from '../constants.js';
|
|
|
|
const inversePrecision = 1 / PRECISION;
|
|
|
|
export default function removePrecision(slices) {
|
|
console.log('remove precision');
|
|
|
|
for (let layer = 0; layer < slices.length; layer ++) {
|
|
const slice = slices[layer];
|
|
|
|
for (let i = 0; i < slice.parts.length; i ++) {
|
|
const part = slice.parts[i];
|
|
|
|
if (part.shape.closed) {
|
|
part.outerLine.scaleDown(inversePrecision);
|
|
for (let i = 0; i < part.innerLines.length; i ++) {
|
|
const innerLine = part.innerLines[i];
|
|
innerLine.scaleDown(inversePrecision);
|
|
}
|
|
part.fill.scaleDown(inversePrecision);
|
|
}
|
|
// else {
|
|
// part.shape.scaleDown(inversePrecision);
|
|
// }
|
|
}
|
|
|
|
if (slice.support !== undefined) {
|
|
slice.support.scaleDown(inversePrecision);
|
|
}
|
|
if (slice.brim !== undefined) {
|
|
slice.brim.scaleDown(inversePrecision);
|
|
}
|
|
}
|
|
}
|