Doodle3D-Slicer/src/sliceActions/applyPrecision.js

24 lines
558 B
JavaScript

import { PRECISION } from '../constants.js'
export default function applyPrecision(shapes) {
for (let i = 0; i < shapes.length; i ++) {
const { fillShapes, lineShapesOpen, lineShapesClosed } = shapes[i];
scaleUpShape(fillShapes);
scaleUpShape(lineShapesOpen);
scaleUpShape(lineShapesClosed);
}
}
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));
}
}
}