Doodle3D-Slicer/src/sliceActions/applyPrecision.js

24 lines
558 B
JavaScript
Raw Normal View History

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 ++) {
2016-10-13 14:24:12 +02:00
const path = shape[i];
2016-10-13 14:24:12 +02:00
for (let i = 0; i < path.length; i ++) {
const point = path[i];
2016-10-13 14:24:12 +02:00
point.copy(point.divideScalar(PRECISION));
}
}
}