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