2016-05-06 19:54:25 +02:00
|
|
|
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);
|
2017-05-19 11:56:53 +02:00
|
|
|
// scaleUpShape(openShapes);
|
2016-05-06 19:54:25 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
function scaleUpShape(shape) {
|
|
|
|
for (let i = 0; i < shape.length; i ++) {
|
2016-10-13 14:24:12 +02:00
|
|
|
const path = shape[i];
|
2016-05-06 19:54:25 +02:00
|
|
|
|
2016-10-13 14:24:12 +02:00
|
|
|
for (let i = 0; i < path.length; i ++) {
|
|
|
|
const point = path[i];
|
2016-05-06 19:54:25 +02:00
|
|
|
|
2016-10-13 14:24:12 +02:00
|
|
|
point.copy(point.divideScalar(PRECISION));
|
|
|
|
}
|
2016-05-06 19:54:25 +02:00
|
|
|
}
|
|
|
|
}
|