mirror of
https://github.com/Doodle3D/Doodle3D-Slicer.git
synced 2024-11-26 15:34:57 +01:00
store calculation in const
This commit is contained in:
parent
a14cf8448d
commit
ba2467b923
@ -1,6 +1,8 @@
|
||||
import * as THREE from 'three.js';
|
||||
import { PRECISION } from '../constants.js';
|
||||
|
||||
const inversePrecision = 1 / PRECISION;
|
||||
|
||||
export default function removePrecision(slices) {
|
||||
console.log('remove precision');
|
||||
|
||||
@ -11,22 +13,22 @@ export default function removePrecision(slices) {
|
||||
const part = slice.parts[i];
|
||||
|
||||
if (part.shape.closed) {
|
||||
part.outerLine.scaleDown(1 / PRECISION);
|
||||
part.outerLine.scaleDown(inversePrecision);
|
||||
for (let i = 0; i < part.innerLines.length; i ++) {
|
||||
const innerLine = part.innerLines[i];
|
||||
innerLine.scaleDown(1 / PRECISION);
|
||||
innerLine.scaleDown(inversePrecision);
|
||||
}
|
||||
part.fill.scaleDown(1 / PRECISION);
|
||||
part.fill.scaleDown(inversePrecision);
|
||||
} else {
|
||||
part.shape.scaleDown(1 / PRECISION);
|
||||
part.shape.scaleDown(inversePrecision);
|
||||
}
|
||||
}
|
||||
|
||||
if (slice.support !== undefined) {
|
||||
slice.support.scaleDown(1 / PRECISION);
|
||||
slice.support.scaleDown(inversePrecision);
|
||||
}
|
||||
if (slice.brim !== undefined) {
|
||||
slice.brim.scaleDown(1 / PRECISION);
|
||||
slice.brim.scaleDown(inversePrecision);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user