mirror of
https://github.com/Doodle3D/Doodle3D-Slicer.git
synced 2024-11-26 07:24:57 +01:00
update add brim code
This commit is contained in:
parent
4825222b09
commit
b4b6e59807
@ -1,9 +1,9 @@
|
|||||||
|
import Shape from 'Doodle3D/clipper-js';
|
||||||
import * as THREE from 'three.js';
|
import * as THREE from 'three.js';
|
||||||
import { PRECISION } from '../constants.js';
|
import { PRECISION } from '../constants.js';
|
||||||
|
|
||||||
const offsetOptions = {
|
const offsetOptions = {
|
||||||
jointType: 'jtSquare',
|
jointType: 'jtRound',
|
||||||
endType: 'etClosedPolygon',
|
|
||||||
miterLimit: 2.0,
|
miterLimit: 2.0,
|
||||||
roundPrecision: 0.25
|
roundPrecision: 0.25
|
||||||
};
|
};
|
||||||
@ -14,8 +14,13 @@ export default function addBrim(slices, settings) {
|
|||||||
let { brimOffset } = settings.config;
|
let { brimOffset } = settings.config;
|
||||||
brimOffset /= PRECISION;
|
brimOffset /= PRECISION;
|
||||||
|
|
||||||
const fistLayer = slices[0];
|
const [fistLayer] = slices;
|
||||||
fistLayer.brim = fistLayer
|
|
||||||
.getOutline()
|
fistLayer.brim = fistLayer.parts.reduce((brim, { shape }) => {
|
||||||
.offset(brimOffset, offsetOptions);
|
brim.join(shape.offset(brimOffset, {
|
||||||
|
...offsetOptions,
|
||||||
|
endType: shape.closed ? 'etClosedPolygon' : 'etOpenRound'
|
||||||
|
}));
|
||||||
|
return brim;
|
||||||
|
}, new Shape([], true)).simplify('pftNonZero');
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user