|
|
|
@ -4,7 +4,7 @@ import { Mat4 } from "@jscad/modeling/src/maths/mat4";
|
|
|
|
|
import { measureAggregateVolume } from "@jscad/modeling/src/measurements";
|
|
|
|
|
import { intersect, scission } from "@jscad/modeling/src/operations/booleans";
|
|
|
|
|
import { Vector2, Vector3 } from "three";
|
|
|
|
|
import { CSGIntersect, Geom3Res } from "../../Common/CSGIntersect";
|
|
|
|
|
import { CSGIntersect } from "../../Common/CSGIntersect";
|
|
|
|
|
import { Board } from "../../DatabaseServices/Entity/Board";
|
|
|
|
|
import { ExtrudeSolid } from "../../DatabaseServices/Entity/Extrude";
|
|
|
|
|
import { Line } from "../../DatabaseServices/Entity/Line";
|
|
|
|
@ -197,14 +197,14 @@ export class BoardCuttingForSweep
|
|
|
|
|
const interCSG = intersect(csg1Clone, csg2Clone);
|
|
|
|
|
interCSG.transforms = meat.OCSInv.elements as Mat4;
|
|
|
|
|
intersect(interCSG, interCSG);
|
|
|
|
|
const interCSGs = scission(interCSG as unknown as Geom3) as unknown as Geom3[];
|
|
|
|
|
const interCSGs = scission(interCSG);
|
|
|
|
|
for (const interCSG of interCSGs)
|
|
|
|
|
{
|
|
|
|
|
// 过滤掉小于肉的100体积的凹槽(这里甩固定值)
|
|
|
|
|
const interVolume = measureAggregateVolume(interCSG);
|
|
|
|
|
if (interVolume < 100)
|
|
|
|
|
continue;
|
|
|
|
|
const topology = new BSPGroupParse(interCSG as unknown as Geom3Res);
|
|
|
|
|
const topology = new BSPGroupParse(interCSG);
|
|
|
|
|
/** 交集部分的包围盒 */
|
|
|
|
|
const box = new Box3Ext(new Vector3(Infinity, Infinity, Infinity), new Vector3(-Infinity, -Infinity, -Infinity));
|
|
|
|
|
const ptsList = topology.Parse();
|
|
|
|
@ -360,7 +360,7 @@ export class BoardCuttingForSweep
|
|
|
|
|
private ProjectCSGToPts(CSG: Geom3, dir: "X" | "Y" | "Z" = "Z")
|
|
|
|
|
{
|
|
|
|
|
// 转为点集
|
|
|
|
|
const topology = new BSPGroupParse(CSG as unknown as Geom3Res);
|
|
|
|
|
const topology = new BSPGroupParse(CSG);
|
|
|
|
|
const ps: Vector3[] = [];
|
|
|
|
|
for (let pts of topology.Parse())
|
|
|
|
|
{
|
|
|
|
|