mirror of
https://github.com/Doodle3D/Doodle3D-Slicer.git
synced 2024-12-23 03:23:48 +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 { PRECISION } from '../constants.js';
|
||||
|
||||
const offsetOptions = {
|
||||
jointType: 'jtSquare',
|
||||
endType: 'etClosedPolygon',
|
||||
jointType: 'jtRound',
|
||||
miterLimit: 2.0,
|
||||
roundPrecision: 0.25
|
||||
};
|
||||
@ -14,8 +14,13 @@ export default function addBrim(slices, settings) {
|
||||
let { brimOffset } = settings.config;
|
||||
brimOffset /= PRECISION;
|
||||
|
||||
const fistLayer = slices[0];
|
||||
fistLayer.brim = fistLayer
|
||||
.getOutline()
|
||||
.offset(brimOffset, offsetOptions);
|
||||
const [fistLayer] = slices;
|
||||
|
||||
fistLayer.brim = fistLayer.parts.reduce((brim, { shape }) => {
|
||||
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