mirror of
https://github.com/Doodle3D/Doodle3D-Slicer.git
synced 2024-11-26 07:24:57 +01:00
24 lines
558 B
JavaScript
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));
|
|
}
|
|
}
|
|
}
|