Files
DOSSIER/src/plan/extrudedSolidSpec.test.ts
T
Claude 45f98e2402 [115][G1][180] 3D: freie Körper aus den Kern-Netzen statt truck
Eine Quelle für die Geometrie freier Körper: 3D-Bild, Pick, Explosion,
Abzugskörper an Wänden/Decken und die Kennwerte der Objekt-Info nehmen
dieselben Kern-Netze (solid_mesh.rs, Manifold) wie Grundriss, Schnitt
und Ansicht.

- model3d/solids.rs: Teil solidMeshes (Owner::Solid für den
  Klassen-Filter, Farbe/Textur aus componentId, glatt schattiert),
  3D-Facettierung mindestens 48 je Vollkreis (Fugen unter dem
  15°-Kantenwinkel von render3d), Explosion hebt mit dem Geschoss.
- pick_solids: Dreiecke des Kern-Netzes statt Prisma-Näherung.
- solid_specs::void_meshes: Wand/Decke minus Abzugskörper im Kern
  (Teil voidMeshes) statt truck-Boolean in TS.
- Abfrage solidProps (Volumen, Oberfläche, Schwerpunkt) statt truck.
- Volle Verjüngung ergibt eine Pyramide (Netz-Spezifikation).
- Entfernt: toWalls3d/extrusions.ts, TRUCK_MESH_READY_EVENT,
  truck-Wrapper extrudePolygon/extrudeCircle/buildSolidMesh,
  needsBrepPath. truck bleibt für STEP und Kollisionsprüfung.
- Golden komplex-model3d: drei Körper neu im Modell.
2026-11-11 17:04:38 +00:00

47 lines
2.0 KiB
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
import { describe, expect, it } from "vitest";
import type { ExtrudedSolid } from "../model/types";
import { extrudedSolidSpec } from "./extrudedSolidSpec";
const sq = [{ x: 0, y: 0 }, { x: 2, y: 0 }, { x: 2, y: 2 }, { x: 0, y: 2 }];
const base: ExtrudedSolid = { id: "e1", type: "extrudedSolid", categoryCode: "20", levelId: "eg", points: sq, height: 3 };
describe("extrudedSolidSpec", () => {
it("Prisma ohne Besonderheiten: einfache Extrusion", () => {
expect(extrudedSolidSpec(base, 1)).toMatchObject({ kind: "extrude", z0: 1, height: 3 });
});
it("Eckenradius landet in der Spezifikation", () => {
const s = { ...base, cornerRadius: 0.3 };
expect(extrudedSolidSpec(s, 0)).toMatchObject({ kind: "extrude", cornerRadius: 0.3 });
});
it("Fase landet in der Spezifikation", () => {
const s = { ...base, chamfer: 0.2 };
expect(extrudedSolidSpec(s, 0)).toMatchObject({ kind: "extrude", chamfer: 0.2 });
});
it("Verjüngung → Loft, volle Verjüngung → Pyramide als Netz ([115])", () => {
expect(extrudedSolidSpec({ ...base, taper: 0.5 }, 0)?.kind).toBe("loft");
expect(extrudedSolidSpec({ ...base, taper: 1 }, 0)).toMatchObject({ kind: "mesh", positions: [0, 0, 0, 2, 0, 0, 2, 2, 0, 0, 2, 0, 1, 1, 3] });
});
it("Kreisprofil → Zylinder bzw. Kegel", () => {
const c = { ...base, circle: { center: { x: 1, y: 1 }, r: 1 } };
expect(extrudedSolidSpec(c, 0)?.kind).toBe("cylinder");
expect(extrudedSolidSpec({ ...c, taper: 1 }, 0)?.kind).toBe("cone");
});
it("Grundkörper (brep): Verschiebung ergibt sich aus points[0] − origin, UK = baseZ", () => {
const moved: ExtrudedSolid = {
...base,
points: sq.map((p) => ({ x: p.x + 5, y: p.y - 1 })),
brep: { spec: { kind: "sphere", center: [1, 1, 1], r: 1 }, origin: { x: 0, y: 0 } },
};
expect(extrudedSolidSpec(moved, 2.6)).toEqual({
kind: "translate",
v: [5, -1, 2.6],
solid: { kind: "sphere", center: [1, 1, 1], r: 1 },
});
});
});