[142] Merge: Schatten nur von Bauteilen über ±0.00, alle in einer Richtung

This commit is contained in:
Claude committed 2026-11-05 23:33:14 +00:00
commit a929f6077f
5 files changed
+103 -9

No files matched your search

+22 -1
View File
@@ -1,5 +1,5 @@
import { describe, expect, it } from "vitest";
import { sunPosition, shadowOfPrism, shadowPolygons, withoutHoles } from "./sun";
import { sunPosition, shadowOfPrism, shadowPolygons, withoutHoles, projectLatLon } from "./sun";
import { polygonArea } from "../geometry/roomArea";
import type { Vec2 } from "../model/types";
import { sampleProject } from "../model/sampleProject";
@@ -66,3 +66,24 @@ describe("Schatten mit Hof", () => {
for (const p of polys) expect(p[0].length).toBeGreaterThanOrEqual(3);
});
});
// [142] Musterhaus komplex, Studienzeitpunkt: alle Schatten von der Sonne weg — kein Schattenpunkt liegt
// weiter zur Sonne hin als der sonnennächste Körperpunkt (früher warfen Untergeschoss-Wände und Stützmauer
// unter ±0.00 Schattenstücke zur Sonne hin).
describe("Schatten in eine Richtung (Musterhaus komplex)", () => {
it("kein Schattenpunkt auf der Sonnenseite der Körper", async () => {
const { buildComplexSampleProject } = await import("../model/sampleProjectComplex");
const p = buildComplexSampleProject();
const { lat, lon } = projectLatLon(p);
const sun = sunPosition(lat, lon, new Date(p.sunStudy!.when));
const az = (sun.azimuth * Math.PI) / 180;
const dot = (v: Vec2) => v.x * Math.sin(az) + v.y * Math.cos(az);
const casters: Vec2[] = [...p.walls.flatMap((w) => [w.start, w.end]), ...(p.extrudedSolids ?? []).flatMap((s) => s.points)];
const shadows = shadowPolygons(p, sun);
expect(shadows.length).toBeGreaterThan(0);
const pts = shadows.flatMap((poly) => poly[0]);
expect(Math.max(...pts.map(dot))).toBeLessThanOrEqual(Math.max(...casters.map(dot)) + 0.3);
// und die Schatten reichen deutlich von der Sonne weg (nicht nur Grundflächen)
expect(Math.min(...pts.map(dot))).toBeLessThan(Math.min(...casters.map(dot)) - 2);
});
});
@@ -1,10 +1,10 @@
viewBox -41.5 0 95 63.6
bytes 155247
bytes 154702
circle 16
line 742
path 63
polygon 258
polygon 256
rect 1
svg 1
text 121
hash a335f363cd3ec3c2
hash 31eb0ce63a3514ff
@@ -1,10 +1,10 @@
viewBox -41.5 0 95 63.6
bytes 166421
bytes 165876
circle 16
line 834
path 69
polygon 258
polygon 256
rect 1
svg 1
text 121
hash 48456a17295f2d0a
hash a9e2d4dd24b3f54c