Doodle3D-Slicer/src/sliceActions/applyPrecision.js

23 lines
500 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 { closedShapes, openShapes } = shapes[i];
scaleUpShape(closedShapes);
scaleUpShape(openShapes);
}
}
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));
}
}
}