mirror of
https://github.com/Doodle3D/Doodle3D-Slicer.git
synced 2024-11-19 04:27:55 +01:00
update add brim code
This commit is contained in:
parent
8bf771b0f9
commit
68f1cd847d
@ -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