3D: Parallel-/Kreuzschraffur der Wand-Oberseite um 90 Grad an die 2D-Kachel angeglichen (Daemmungslinien stehen quer zur Wand)

This commit is contained in:
karim committed 2026-10-23 11:51:28 +02:00
1 parent 7db634d7d5
commit 6e22c0e15e
2 files changed
+8 -4

No files matched your search

+3 -3
View File
@@ -2765,7 +2765,7 @@ describe("emitStairs — gerade Betontreppe im Schnitt: glatte Soffit-Untersicht
});
describe("Wand-Schraffur in der Draufsicht (topAngle)", () => {
it("relativeToWall-Muster folgt der Wandachse: Wand längs x → 0°, längs y → 90°", () => {
it("relativeToWall-Muster folgt der Wandachse: Dämmungs-Linien stehen QUER zur Wand (wie im 2D): längs x → 90°, längs y → 0°", () => {
const p: Project = {
...sampleProject,
hatches: sampleProject.hatches.map((h) =>
@@ -2780,7 +2780,7 @@ describe("Wand-Schraffur in der Draufsicht (topAngle)", () => {
const alongY = ins.filter((w) => along(w, 1));
expect(alongX.length).toBeGreaterThan(0);
expect(alongY.length).toBeGreaterThan(0);
for (const w of alongX) expect(Math.abs(((w.hatch!.topAngle ?? 99) + 360) % 180)).toBeLessThan(1e-6);
for (const w of alongY) expect(Math.abs((((w.hatch!.topAngle ?? 0) % 180) + 180) % 180 - 90)).toBeLessThan(1e-6);
for (const w of alongX) expect(Math.abs((((w.hatch!.topAngle ?? 0) % 180) + 180) % 180 - 90)).toBeLessThan(1e-6);
for (const w of alongY) expect((((w.hatch!.topAngle ?? 99) % 180) + 180) % 180).toBeLessThan(1e-6);
});
});
+5 -1
View File
@@ -191,7 +191,11 @@ function withTopAngle(h: RHatch, dx: number, dy: number): RHatch {
if (h.baseAngle === undefined) return h;
const wallAngle = (Math.atan2(dy, dx) * 180) / Math.PI;
const svgAngle = h.relativeToWall ? h.baseAngle - wallAngle : h.baseAngle;
return { ...h, topAngle: -svgAngle };
// Parallel-/Kreuzschar (diagonal=2, crosshatch=3): die 2D-Kachel trägt bei Winkel 0 eine
// SENKRECHTE Musterlinie (glPlanHatch: Basisrichtung (0,−1)), der 3D-Shader bei Winkel 0
// eine HORIZONTALE → um 90° versetzen. Die Dämmungs-Welle (4) läuft in beiden entlang u.
const quarter = h.pattern === 2 || h.pattern === 3 ? 90 : 0;
return { ...h, topAngle: -svgAngle + quarter };
}
/**