mirror of
https://github.com/Doodle3D/Doodle3D-Slicer.git
synced 2024-11-26 15:34:57 +01:00
23 lines
500 B
JavaScript
23 lines
500 B
JavaScript
import { PRECISION } from '../constants.js'
|
|
|
|
export default function applyPrecision(shapes) {
|
|
for (let i = 0; i < shapes.length; i ++) {
|
|
const { closedShapes, openShapes } = shapes[i];
|
|
|
|
scaleUpShape(closedShapes);
|
|
scaleUpShape(openShapes);
|
|
}
|
|
}
|
|
|
|
function scaleUpShape(shape) {
|
|
for (let i = 0; i < shape.length; i ++) {
|
|
const path = shape[i];
|
|
|
|
for (let i = 0; i < path.length; i ++) {
|
|
const point = path[i];
|
|
|
|
point.copy(point.divideScalar(PRECISION));
|
|
}
|
|
}
|
|
}
|