From f21aab775f0cb88fbb8536282fd0f408440c5424 Mon Sep 17 00:00:00 2001 From: Fr0zka Date: Sun, 1 Nov 2026 14:18:19 +0100 Subject: [PATCH] research: passage exclusion envelope at plan time (L148, 7/16; kept as patch) Seed-2 shell carver measured: vertical-shafts route-edge-0, the layer's own connection edge from the 2-3 lower mouth. Connection edges legitimately run beside the passage 12-20 m from the mouth, so an 8 m mouth-sphere exclusion rejects 9/16 otherwise valid plans. Points to one continuous tube across the mouth instead of two overlapping ones. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_016dhxM43dnWvUu2B5Ph1iG1 --- .../WorldAssemblerM3/Linux148/REPORT.md | 29 + .../Linux148/RunL148Determinism.py | 97 ++++ .../Linux148/RunL148SeedSweep.py | 158 +++++ .../RunL148Determinism.cpython-313.pyc | Bin 0 -> 6847 bytes .../RunL148SeedSweep.cpython-313.pyc | Bin 0 -> 12249 bytes .../Linux148/l148-exclusion-envelope.patch | 541 ++++++++++++++++++ 6 files changed, 825 insertions(+) create mode 100644 Standalone/Research/WorldAssemblerM3/Linux148/REPORT.md create mode 100644 Standalone/Research/WorldAssemblerM3/Linux148/RunL148Determinism.py create mode 100644 Standalone/Research/WorldAssemblerM3/Linux148/RunL148SeedSweep.py create mode 100644 Standalone/Research/WorldAssemblerM3/Linux148/__pycache__/RunL148Determinism.cpython-313.pyc create mode 100644 Standalone/Research/WorldAssemblerM3/Linux148/__pycache__/RunL148SeedSweep.cpython-313.pyc create mode 100644 Standalone/Research/WorldAssemblerM3/Linux148/l148-exclusion-envelope.patch diff --git a/Standalone/Research/WorldAssemblerM3/Linux148/REPORT.md b/Standalone/Research/WorldAssemblerM3/Linux148/REPORT.md new file mode 100644 index 0000000..412277d --- /dev/null +++ b/Standalone/Research/WorldAssemblerM3/Linux148/REPORT.md @@ -0,0 +1,29 @@ +# Linux148 — passage exclusion envelope + +**Result:** The shared plan-time bounds audit and its negative control work, and the L147 seed-2 carver is identified. The 8 m mouth joint is too small for the existing route candidates: both composed matrices pass only **7/16** seeds. Per the three-failure stop rule, this round stops without another planner adjustment and is not ready to promote. + +## Root cause and rule + +The L147 Vertical Shafts seed-2 wall sample at `(-21.678, -1.714, -888.614) m` is carved by `vertical-shafts/strate-3/route-edge-0`. At that point its native tube/floor SDF combines to about `-0.553 m`, predicting `+2.21` Core voxels of air; the observed native density is `+2.341949`. No other cave primitive has a negative native SDF there. The edge's start anchor is `passage/2-3/0/lower-mouth`, confirming this sample lies in its passage connection. + +The shared gate samples the resolved passage spline, expands it by the 1.053 m shell/influence reach, and checks each layer primitive's conservative AABB against that envelope. It permits overlap only for a named passage mouth, within an 8 m sphere (the planner's 2 m overlap plus 6 m lead). Other overlap rejects the graph before it is written into the layout. A forced AABB at a passage centerline is rejected as the negative control. + +The shared Core API is generic; this round wires it through `PlanResolvedCavernNetworkV1`, used by Tunnel Network and Vertical Shafts. Other layer planners must call it when they resolve their primitive bounds. + +The mouth radius is the limiting assumption. Existing route-edge bounds in Tunnel Network seeds 0, 1, 4, and 7 meet passage `1-2` at 12.5–19.6 m from the mouth; seed 8 also has room bounds at 17.5–20.5 m. These are connected route candidates, but they fall outside the 8 m sphere. In seed 10, `vertical-shafts/strate-3/shaft-1/primitive-0` also overlaps passage `2-3`; it has no mouth association and remains a separate candidate to resolve. + +## Measurements and checks + +- Clang 19 and GCC builds passed with source stamp `593551a985ec0d1acc271260e4c8f15a5261c90edb60e33a56ed6df27e269ffb`. +- Tunnel Network: **7/16**; full runs were seeds 2, 3, 5, 6, 9, 11, and 12. Vertical Shafts: **7/16**, the same seeds. The other nine seeds in each matrix were rejected by the plan-time exclusion audit. The run logs and per-seed layouts are under `Saved/Linux/l148/seeds/`. +- Across the seven full runs in each matrix: 2,186,289 passage-interior capsule samples, zero solid; 53,262 shell wall samples, zero violations. Passage, ripple, and negative-control gates passed on those runs. Seed 2's passage `2-3` had zero wall samples outside the mouth joint, so its shell result has no wall coverage beyond that joint. +- The passing layouts match their L147 stable identities. Seed 2 is `resolved-layout-v3-fnv64:64988eac83c0220c`. +- Fast tier passed in 362.6 s: `Saved/Linux/l148/fast/fast-summary.json`. +- Clang/GCC W1/W8/W12 passed on seed 2: 13 pipeline hash lines and the resolved-layout identity matched across all six runs. Summary: `Saved/Linux/l148/determinism/summary.json`. +- `git diff --check` and Python syntax checks passed. No Unreal build was run. + +The successful outputs remain evaluator v237 and layout-identical to L147. No baselines or captures were added. The nine rejected seeds produced no resolved layout, so there is no accepted before/after scene to capture. This is an incomplete, unpromoted planner change. + +## Remaining risk + +The audit catches conservative-bounds conflicts, but the current mouth sphere does not cover the existing connected-route bounds, and the optional shaft collision needs a deterministic candidate decision. The 16/16 requirement is unmet. No Unreal `Source/` files changed. diff --git a/Standalone/Research/WorldAssemblerM3/Linux148/RunL148Determinism.py b/Standalone/Research/WorldAssemblerM3/Linux148/RunL148Determinism.py new file mode 100644 index 0000000..c9ec119 --- /dev/null +++ b/Standalone/Research/WorldAssemblerM3/Linux148/RunL148Determinism.py @@ -0,0 +1,97 @@ +#!/usr/bin/env python3 +"""Compare L148 composed owner hashes and layout identity at W1/W8/W12.""" +from __future__ import annotations + +import json +import re +import subprocess +import time +from pathlib import Path + + +ROOT = Path(__file__).resolve().parents[4] +OUT = ROOT / "Saved/Linux/l148/determinism" +DATA = ROOT / "Standalone/data/owner_world.json" +BINARIES = { + "clang": ROOT / "Standalone/bin/linux/VoxelForgeCoreHeadless-l148-clang", + "gcc": ROOT / "Standalone/bin/linux/VoxelForgeCoreHeadless-l148-gcc", +} +CAMERA = "-20.062500,-5.068359,-900.353516,0,0" +HASH_RE = re.compile( + r"^\[Pipeline(?:FullDetailHash|WholeViewHash|MaterialHash|LODHash|ExactQueryHash)\].*$", + re.M) +STAMP_RE = re.compile(r"^\[VoxelForgeSourceStamp\] sha256=([0-9a-f]+)$", re.M) +EXCLUSION_RE = re.compile( + r"^\[CavernPassageExclusionAudit\] strate=[23] primitives=\d+ " + r"outside_joint=0 mouth_joint=\d+ negative_controls=1/1 " + r"first_primitive=none first_passage=none status=PASS$", re.M) + + +def main() -> int: + if any(not path.is_file() for path in (DATA, *BINARIES.values())): + raise SystemExit("missing L148 Clang/GCC binary or composed owner fixture") + OUT.mkdir(parents=True, exist_ok=True) + rows = [] + reference_hashes: tuple[str, ...] | None = None + reference_identity: str | None = None + reference_stamp: str | None = None + for compiler, binary in BINARIES.items(): + for workers in (1, 8, 12): + name = f"determinism-{compiler}-w{workers}" + log, layout = OUT / f"{name}.log", OUT / f"{name}.json" + command = ["taskset", "-c", "0-11", "prlimit", "--as=6442450944", "--", + "timeout", "1740s", str(binary), str(DATA), "--world-assembler-prototype", + "--stream-benchmark", "--stream-pipeline", f"--workers={workers}", + "--clip-radius=3", "--max-clip-level=8", "--max-level=0", + f"--camera={CAMERA}", "--stream-hash", "--force-generate", "--seed=2", + "--recipe=surface-world", "--render-distance-chunks=0", + "--density-dispatch-report", "--audit-resolved-layout-passages", + "--audit-passage-tile-seams", f"--resolved-layout-output={layout}"] + started = time.monotonic() + with log.open("w", encoding="utf-8") as output: + proc = subprocess.run(command, cwd=ROOT, stdout=output, + stderr=subprocess.STDOUT, check=False, timeout=1740) + content = log.read_text(encoding="utf-8", errors="replace") + stamp_match = STAMP_RE.search(content) + stamp = stamp_match.group(1) if stamp_match else None + hashes = tuple(HASH_RE.findall(content)) + identity = (json.loads(layout.read_text(encoding="utf-8")).get("stable_identity") + if layout.is_file() else None) + audits = EXCLUSION_RE.findall(content) + shell_ok = bool(re.search( + r"^\[PassageShellAuditSummary\].*status=PASS$", content, re.M)) + passed = (proc.returncode == 0 and stamp is not None and bool(hashes) + and len(audits) == 2 and shell_ok and bool(identity)) + if reference_stamp is None and passed: + reference_stamp, reference_hashes, reference_identity = stamp, hashes, identity + else: + passed = (passed and stamp == reference_stamp and hashes == reference_hashes + and identity == reference_identity) + row = {"compiler": compiler, "workers": workers, "exit": proc.returncode, + "stamp": stamp, "hash_lines": len(hashes), + "hashes_match_first": hashes == reference_hashes, + "layout_identity": identity, + "layout_matches_first": identity == reference_identity, + "exclusion_audits": len(audits), "shell_gate": shell_ok, + "passed": bool(passed), + "elapsed_s": round(time.monotonic() - started, 3), + "log": str(log.relative_to(ROOT)), "layout": str(layout.relative_to(ROOT))} + rows.append(row) + print("[L148DeterminismRun] " + json.dumps(row, sort_keys=True), flush=True) + (OUT / "runs-partial.json").write_text(json.dumps(rows, indent=2) + "\n", + encoding="utf-8") + if not passed: + (OUT / "summary.json").write_text(json.dumps( + {"status": "FAIL", "runs": rows}, indent=2) + "\n", encoding="utf-8") + raise SystemExit(f"composed owner determinism mismatch; see {log}") + summary = {"status": "PASS", "stamp": reference_stamp, + "layout_identity": reference_identity, "runs": rows} + (OUT / "summary.json").write_text(json.dumps(summary, indent=2) + "\n", + encoding="utf-8") + print(f"[L148DeterminismSummary] runs={len(rows)} source_stamp={reference_stamp} " + f"status=PASS") + return 0 + + +if __name__ == "__main__": + raise SystemExit(main()) diff --git a/Standalone/Research/WorldAssemblerM3/Linux148/RunL148SeedSweep.py b/Standalone/Research/WorldAssemblerM3/Linux148/RunL148SeedSweep.py new file mode 100644 index 0000000..75f36e0 --- /dev/null +++ b/Standalone/Research/WorldAssemblerM3/Linux148/RunL148SeedSweep.py @@ -0,0 +1,158 @@ +#!/usr/bin/env python3 +"""Run the L148 composed passage gates for all 16 owner seeds.""" +from __future__ import annotations + +import argparse +import json +import re +import subprocess +import time +from pathlib import Path + + +ROOT = Path(__file__).resolve().parents[4] +OUT = ROOT / "Saved/Linux/l148/seeds" +BIN = ROOT / "Standalone/bin/linux/VoxelForgeCoreHeadless-l148-clang" +DATA = ROOT / "Standalone/data/owner_world.json" +STAMP = "593551a985ec0d1acc271260e4c8f15a5261c90edb60e33a56ed6df27e269ffb" +STAMP_RE = re.compile(r"^\[VoxelForgeSourceStamp\] sha256=([0-9a-f]+)$", re.M) +BASELINES = { + "tunnel-network": ROOT / "Saved/Linux/l135/optimized-seed-sweep.json", + "vertical-shafts": ROOT / "Saved/Linux/l139/seeds/summary.json", +} +DISPATCH = { + "tunnel-network": re.compile( + r"^\[DensityDispatch\] strate=2 generator=TunnelNetwork " + r"recipe=Core\.Caves\.PrimitiveField version=1 " + r"bound_path=Caves-native adapter=FCavesFieldAdapter$", re.M), + "vertical-shafts": re.compile( + r"^\[DensityDispatch\] strate=3 generator=VerticalShafts " + r"recipe=Core\.Caves\.PrimitiveField version=1 " + r"bound_path=Caves-native adapter=FCavesFieldAdapter$", re.M), +} +ROUTES = { + "tunnel-network": re.compile( + r"^\[ResolvedStrateRouteAudit\] strate=2 .*unsupported=0 " + r"grade_failures=0 .*status=PASS$", re.M), + "vertical-shafts": re.compile( + r"^\[ResolvedStrateRouteAudit\] strate=3 .*unsupported=0 " + r"grade_failures=0 .*status=PASS$", re.M), +} +CONTROLS = { + "tunnel-network": re.compile( + r"^\[TunnelNetworkBlockedRouteControl\].*expected=FAIL status=PASS$", re.M), + "vertical-shafts": re.compile( + r"^\[VerticalShaftsBlockedRouteControl\].*expected=FAIL status=PASS$", re.M), +} +REQUIRED = { + "passages": re.compile(r"^\[ResolvedPassageAuditSummary\].*status=PASS$", re.M), + "seams": re.compile(r"^\[PassageTileSeamAudit\].*status=PASS$", re.M), + "shell": re.compile(r"^\[PassageShellAuditSummary\].*status=PASS$", re.M), + "naturalness": re.compile(r"^\[PassageNaturalnessSummary\].*status=PASS$", re.M), + "mouth_profile": re.compile(r"^\[PassageMouthProfileSummary\].*status=PASS$", re.M), + "ripple": re.compile(r"^\[PassageRippleAuditSummary\].*status=PASS$", re.M), + "passage_interior": re.compile( + r"^\[PassageInteriorCapsuleAuditSummary\].*status=PASS$", re.M), +} +EXCLUSION = { + strate: re.compile( + rf"^\[CavernPassageExclusionAudit\] strate={strate} primitives=\d+ " + r"outside_joint=0 mouth_joint=\d+ negative_controls=1/1 " + r"first_primitive=none first_passage=none status=PASS$", re.M) + for strate in (2, 3) +} + + +def main() -> int: + parser = argparse.ArgumentParser(description=__doc__) + parser.add_argument("--kind", choices=tuple(BASELINES), required=True) + args = parser.parse_args() + if not BIN.is_file() or not DATA.is_file(): + raise SystemExit("missing L148 Clang binary or composed owner fixture") + baseline_path = BASELINES[args.kind] + baseline = json.loads(baseline_path.read_text(encoding="utf-8")) + baseline_results = {int(row["seed"]): row for row in baseline["results"]} + OUT.mkdir(parents=True, exist_ok=True) + mode_out = OUT / args.kind + mode_out.mkdir(parents=True, exist_ok=True) + results = [] + partial = mode_out / "runs-partial.json" + for seed in range(16): + log = mode_out / f"seed{seed}.log" + layout = mode_out / f"seed{seed}.json" + old_layout = ROOT / f"Saved/Linux/l147/seeds/{args.kind}/seed{seed}.json" + command = ["taskset", "-c", "0-11", "prlimit", "--as=6442450944", "--", + "timeout", "1740s", str(BIN), str(DATA), "--world-assembler-prototype", + "--stream-benchmark", "--stream-pipeline", "--workers=8", "--clip-radius=3", + "--max-clip-level=8", "--max-level=0", "--force-generate", f"--seed={seed}", + "--recipe=surface-world", "--density-dispatch-report", + "--audit-resolved-layout-passages", "--audit-passage-tile-seams", + f"--resolved-layout-output={layout}"] + started = time.monotonic() + with log.open("w", encoding="utf-8") as output: + proc = subprocess.run(command, cwd=ROOT, stdout=output, + stderr=subprocess.STDOUT, check=False, timeout=1740) + content = log.read_text(encoding="utf-8", errors="replace") + stamp = STAMP_RE.search(content) + checks = {name: bool(pattern.search(content)) for name, pattern in REQUIRED.items()} + checks["source_stamp"] = stamp is not None and stamp.group(1) == STAMP + checks["dispatch"] = bool(DISPATCH[args.kind].search(content)) + checks["route"] = bool(ROUTES[args.kind].search(content)) + checks["blocked_route_control"] = bool(CONTROLS[args.kind].search(content)) + checks["strate2_exclusion_audit"] = bool(EXCLUSION[2].search(content)) + checks["strate3_exclusion_audit"] = bool(EXCLUSION[3].search(content)) + checks["three_passage_interiors"] = len(re.findall( + r"^\[ResolvedPassageAudit\].*interior_air=PASS", content, re.M)) == 3 + checks["three_interior_negative_controls"] = len(re.findall( + r"^\[ResolvedPassageInteriorNegativeControl\].*detected=true status=PASS$", + content, re.M)) == 3 + checks["three_ripple_gap_controls"] = len(re.findall( + r"^\[PassageRippleSamplingControl\].*status=PASS$", content, re.M)) == 3 + checks["three_blocked_passage_controls"] = len(re.findall( + r"^\[ResolvedPassageBlockedControl\].*detected=true$", content, re.M)) == 3 + checks["passage_count"] = len(re.findall( + r"^\[ResolvedPassageAudit\].*walkability=PASS$", content, re.M)) == 3 + checks["layout_output"] = layout.is_file() + old_identity = None + new_identity = None + if layout.is_file(): + new_identity = json.loads(layout.read_text(encoding="utf-8")).get("stable_identity") + if old_layout.is_file(): + old_identity = json.loads(old_layout.read_text(encoding="utf-8")).get("stable_identity") + checks["layout_identity_matches_l147"] = ( + old_identity is not None and new_identity is not None + and old_identity == new_identity) + passed = proc.returncode == 0 and all(checks.values()) + prior = baseline_results.get(seed, {}) + prior_passed = bool(prior.get("passed", False)) + change = ("newly failing" if prior_passed and not passed else + "newly passing" if not prior_passed and passed else + "still passing" if prior_passed else "still failing") + failed_checks = [name for name, ok in checks.items() if not ok] + reason = (", ".join(failed_checks) if failed_checks else + "all gates pass and resolved identity matches L147" if passed else + f"process exit {proc.returncode}") + row = {"kind": args.kind, "seed": seed, + "prior_verdict": "PASS" if prior_passed else "FAIL", + "verdict": "PASS" if passed else "FAIL", "change": change, + "reason": reason, "exit": proc.returncode, "checks": checks, + "layout_identity": new_identity, + "elapsed_s": round(time.monotonic() - started, 3), + "log": str(log.relative_to(ROOT)), "layout": str(layout.relative_to(ROOT))} + results.append(row) + print("[L148SeedSweep] " + json.dumps(row, sort_keys=True), flush=True) + partial.write_text(json.dumps(results, indent=2) + "\n", encoding="utf-8") + passed_count = sum(row["verdict"] == "PASS" for row in results) + summary = {"kind": args.kind, "source_stamp": STAMP, + "baseline": str(baseline_path.relative_to(ROOT)), "seeds": list(range(16)), + "passed": passed_count, "failed": 16 - passed_count, "results": results} + summary_path = mode_out / "summary.json" + summary_path.write_text(json.dumps(summary, indent=2) + "\n", encoding="utf-8") + print(f"[L148SeedSweepSummary] kind={args.kind} passed={passed_count}/16 " + f"failed={16-passed_count} status={'PASS' if passed_count == 16 else 'FAIL'}", + flush=True) + return 0 if passed_count == 16 else 1 + + +if __name__ == "__main__": + raise SystemExit(main()) diff --git a/Standalone/Research/WorldAssemblerM3/Linux148/__pycache__/RunL148Determinism.cpython-313.pyc b/Standalone/Research/WorldAssemblerM3/Linux148/__pycache__/RunL148Determinism.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..702f9667eb475264dd12ecaf7dfb4148d0583778 GIT binary patch literal 6847 zcmbU`TWlLwc6Z3(LnI}UdOs|idfJpkkrMT=98tEShb2q4Y+jA!EaebmawO3vXNVcn zwzvyd+kUJz{fLtyh_f5O!tSC~+n{xK4Mashs$v(Y3M|l>RZy`LZQ){rF8pW10fP3c z=MFU@S4o=gj-h+coO|xM=bqP`L%%95wIO)^>)dZ|(^UxlhP>zxod>8_?@|c8hcFTm zrm$g_x?~UyZUP%;jiOPTX_3}ulW5XrvuK8yp0!-EidHvTvbLb5k^$gDo=|muE*=LC zUqUs-*gT9)CICdok^`H)c7RF&vS?5lKvn|5Tta4S>oJJs*e*Jk=upd-d9@(yfR(l{ zuM8OSII;3;cb0y`&Z@87S@sP(tFa50H=x_JShG}%o#$>K#FoOX>OgNbElAgnu0f7k zF?uSp6XQZM#fqGJuDAcJI|?s?#KqjgJ)RTYtE{xjNp6;pxfAS~kV(7aF^*5i(`#-v z?OyElEuQr)_V)EWC)f5+s-5L|A2LwZAsv>gGCg#;=C`RF}g0?=Mqzb zxWbJKA~(&ku>>bcUc%oSO|bk*w*U9uw-Swd45~@nt{UMj+ve@__xK0<2K@eR?*Kq& z0|Ud|-eJGLCom8g=pF3#cl)yoZ!U$e##0G7EQ)v-zdD`3VgG)kv3NFRE++bk|EF8Hl#QAj4?@j_@_3(|X^V|v;_bwNS3Vd1=5>l|&*Xv%6 zi&8pr#45;x6?J4@hCE6F&&Wu@t790qMe~7@A5X$$M2LFzp_OEb@L`NYBvK71d>B&* z`Ka(=K7shR6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AtzZ1iWZf85O!fP8yFwGa-2Tz+ zC$&2+rDGg!(s3#08wB>I4q$IO`x#v#J32oKY^DEtc&qEln>+LJ_`(ZBF;pFl_WI9( zsNtF2@dZPHzyF)d|34BbMSmXbzB*!&M{L*ZcGVhzOcv)O5%RUnr)t#*IoMOLS|X8{ z5RF7sTO_iaA+>HKB9a0_43S}x45YmkCtx5oaC$Wnza>JFLWC`;|6wzfJz5ziIteLh zPsQ_OAU~;y|+^Dz?ucYvnK84|hk)o*oM3;VzT7HA&*taw( zmZm++seQ|7#d3O!QY@Y8bk1y(OS=?v*SaxhvCCzC#o}M5pOw1gsyU@}E@v;7E2b6u z^h=Y`VOY1mup*m(-JG*I-tK&>Ge?JWwE24z-<^16GT3eF7DzOXvbWE@bq-R@t`^XH z_ABewT)FG*>|5Cv27_tjS@8TnF8uw%D~r)NPOUpWcbun6UrZPf?byif8SDSuR`t%p VpIzUxosj7hV1K$n{3E#E{{q(Yf205a literal 0 HcmV?d00001 diff --git a/Standalone/Research/WorldAssemblerM3/Linux148/__pycache__/RunL148SeedSweep.cpython-313.pyc b/Standalone/Research/WorldAssemblerM3/Linux148/__pycache__/RunL148SeedSweep.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..d86f84f3121384316fdc79b41b1d952c7aa7b4d5 GIT binary patch literal 12249 zcmcIqYit|Wm7XDo?}y%^9+XANv}`FNskbcIa;&#y>t&88IiX|jh%=ICQ$u!!^n-0v zwfm!Teyr_uyHbi^t#kue-WrJ74G=XbwhFe`C}@Ci!XV;K)xe7uSmd7^2Pm@GAA9bQ zBT9;;#NI9e&AoH)J&$|tx#ynwt{$6AdJKLqxBl1VpV%<$Pv}MdNj(^bKmI!c!+wg9 z7>AKKsW^w9Rd5O$sw>YaIi*w*93hn|P9>FUPA!!hP6H)zPJ33z>1^0VT_tu=-;Ae3 zxGl1%Oxc{Sx{ESxa*b4}pvsvpnn<<705vnzG*T@KYFeq5P3pLuiz>HWrplC+7^#Pz zs!WSqYgV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n(sxw=ZvK$^=bWLQ}q>IVxz5F5`lxW{yaz^>Nb?L49OSDOGy~buUykhPb&-(A2>I z?b$h1(qOvP{z`kiuzy{Oj|s!@oc3X1NxW=8C>#J6j34S2EZvV(N|Rzvx24A{#S52T zy}YGR=$?Ogy6b)7J>s!OY3akav{+HeLhRMpp01)k{E}Y&Z3-D?TDVAQGmb zWM08S`>XBoLutN=ys>0~W#PqFUyR#EMb3nGR$|~I(rk+ zyT+BimE&8O;^b)@p1RZc!_Mya^WVz{3!D1!FEFL5AAh6;x<`n^obJoq3pif0bya~8 s#`#!6S^OXR{5xYm8Bge~al*Q##E6owz8Fx#SRPVM?EMqZ4Je5J1;7DkYybcN literal 0 HcmV?d00001 diff --git a/Standalone/Research/WorldAssemblerM3/Linux148/l148-exclusion-envelope.patch b/Standalone/Research/WorldAssemblerM3/Linux148/l148-exclusion-envelope.patch new file mode 100644 index 0000000..737b7ef --- /dev/null +++ b/Standalone/Research/WorldAssemblerM3/Linux148/l148-exclusion-envelope.patch @@ -0,0 +1,541 @@ +diff --git a/Standalone/Core/include/VoxelForgeCore/VoxelForgeCore.h b/Standalone/Core/include/VoxelForgeCore/VoxelForgeCore.h +index 8c44461..a271b75 100644 +--- a/Standalone/Core/include/VoxelForgeCore/VoxelForgeCore.h ++++ b/Standalone/Core/include/VoxelForgeCore/VoxelForgeCore.h +@@ -1226,6 +1226,39 @@ namespace VoxelForgeCore + std::vector controlPoints; + }; + ++ // Passage shell, relief, smooth-max support, and rounding guard in the shared ++ // planner's integer micrometre coordinate space. Keep this aligned with the ++ // passage evaluator's L130 reach contract. ++ inline constexpr double ResolvedPassageInfluenceReachMicrometresV1 = ++ (0.75 + 0.21 + 0.50 / 6.0 + 0.01) * 1000000.0; ++ // The bounded joint covers the planner's 2 m mouth overlap and 6 m portal lead. ++ inline constexpr std::int64_t ResolvedPassageMouthJointRadiusMicrometresV1 = 8000000; ++ ++ // A planner passes the conservative bounds of each layer primitive through this ++ // shared gate. Only explicitly associated mouth-joint primitives may overlap ++ // the bounded spatial joint around their named passage mouth. ++ struct ResolvedLayoutPrimitiveBoundsV1 ++ { ++ std::string stableId; ++ std::int32_t strateIndex = -1; ++ std::array boundsMinimumMicrometres{}; ++ std::array boundsMaximumMicrometres{}; ++ std::string mouthJointPassageStableId; ++ std::int64_t mouthJointRadiusMicrometres = 0; ++ }; ++ ++ struct ResolvedLayoutPassageExclusionAuditV1 ++ { ++ std::uint64_t primitivesChecked = 0; ++ std::uint64_t overlapsOutsideJoint = 0; ++ std::uint64_t mouthJointAssociations = 0; ++ std::uint32_t negativeControlsRun = 0; ++ std::uint32_t negativeControlsRejected = 0; ++ std::string firstOverlappingPrimitive; ++ std::string firstOverlappingPassage; ++ bool passed = false; ++ }; ++ + struct ResolvedLayoutPassageConfigV1 + { + std::int32_t upperStrateIndex = -1; +@@ -1340,6 +1373,14 @@ namespace VoxelForgeCore + std::vector& rooms, + std::vector& edges, + std::string& error); ++ VFCORE_API bool IsResolvedLayoutPrimitiveOutsidePassageEnvelopeV1( ++ const ResolvedLayoutSnapshotV3& layout, ++ const ResolvedLayoutPrimitiveBoundsV1& primitive, ++ std::string& conflictingPassageStableId); ++ VFCORE_API ResolvedLayoutPassageExclusionAuditV1 ++ AuditResolvedLayoutPassageExclusionV1( ++ const ResolvedLayoutSnapshotV3& layout, ++ std::span primitives); + VFCORE_API bool ResolveResolvedLayoutOreVeinsV1( + ResolvedLayoutSnapshotV3& layout, std::int32_t seed, + std::span requests, +diff --git a/Standalone/Core/src/ResolvedLayoutInternal.h b/Standalone/Core/src/ResolvedLayoutInternal.h +index 7b7520a..2550c77 100644 +--- a/Standalone/Core/src/ResolvedLayoutInternal.h ++++ b/Standalone/Core/src/ResolvedLayoutInternal.h +@@ -2306,6 +2306,301 @@ bool ResolveResolvedCavernGraphV1(ResolvedLayoutSnapshotV3& layout,std::int32_t + layout=std::move(candidate);return true; + } + ++namespace ++{ ++ struct FResolvedPassageEnvelopeSegment ++ { ++ std::string stableId; ++ std::int32_t upperStrateIndex=-1,lowerStrateIndex=-1; ++ std::array a{},b{}; ++ std::array upperMouthCenter{},lowerMouthCenter{}; ++ double radiusMicrometres=0.0; ++ double alongMicrometres=0.0,lengthMicrometres=0.0,totalLengthMicrometres=0.0; ++ }; ++ ++ std::vector BuildResolvedPassageEnvelopeSegments( ++ const ResolvedLayoutSnapshotV3& layout) ++ { ++ std::vector result; ++ for(const auto& passage:layout.passages) ++ { ++ if(passage.controlPoints.size()<2||layout.coreVoxelSizeMicrometres==0)continue; ++ const std::size_t routeEnd=std::clamp( ++ passage.lowerMouthControlIndex,1,passage.controlPoints.size()-1); ++ std::vector controls; ++ controls.reserve(passage.controlPoints.size()); ++ const double scale=static_cast(layout.coreVoxelSizeMicrometres) ++ /WorldAssemblySubvoxelsPerVoxel; ++ for(const auto& point:passage.controlPoints) ++ controls.push_back({point.positionSubvoxels[0]*scale, ++ point.positionSubvoxels[1]*scale,point.positionSubvoxels[2]*scale, ++ point.radiusSubvoxels*scale}); ++ const auto segments=PassageSpline::BuildSegments(controls,routeEnd,2.0, ++ 1000000.0); ++ if(segments.empty())continue; ++ const double totalLength=(segments.back().alongMetres ++ +segments.back().lengthMetres)*1000000.0; ++ const std::size_t lowerMouthIndex=std::min(routeEnd,controls.size()-1); ++ for(const auto& segment:segments) ++ { ++ FResolvedPassageEnvelopeSegment envelope; ++ envelope.stableId=passage.stableId; ++ envelope.upperStrateIndex=passage.upperStrateIndex; ++ envelope.lowerStrateIndex=passage.lowerStrateIndex; ++ for(std::size_t axis=0;axis<3;++axis) ++ { ++ envelope.a[axis]=segment.a[axis]; ++ envelope.b[axis]=segment.b[axis]; ++ envelope.upperMouthCenter[axis]=controls.front()[axis]; ++ envelope.lowerMouthCenter[axis]=controls[lowerMouthIndex][axis]; ++ } ++ envelope.radiusMicrometres=std::max(segment.a[3],segment.b[3]); ++ envelope.alongMicrometres=segment.alongMetres*1000000.0; ++ envelope.lengthMicrometres=segment.lengthMetres*1000000.0; ++ envelope.totalLengthMicrometres=totalLength; ++ result.push_back(std::move(envelope)); ++ } ++ } ++ return result; ++ } ++ ++ bool ResolvedPrimitiveBoundsOverlap(const ResolvedLayoutPrimitiveBoundsV1& primitive, ++ const std::array& segmentA,const std::array& segmentB, ++ double envelopeRadius) ++ { ++ std::array direction{}; ++ std::vector breakpoints{0.0,1.0}; ++ for(std::size_t axis=0;axis<3;++axis) ++ { ++ direction[axis]=segmentB[axis]-segmentA[axis]; ++ if(std::abs(direction[axis])<=1.0e-18)continue; ++ for(const auto boundary:{static_cast(primitive.boundsMinimumMicrometres[axis]), ++ static_cast(primitive.boundsMaximumMicrometres[axis])}) ++ { ++ const double t=(boundary-segmentA[axis])/direction[axis]; ++ if(t>0.0&&t<1.0)breakpoints.push_back(t); ++ } ++ } ++ std::sort(breakpoints.begin(),breakpoints.end()); ++ breakpoints.erase(std::unique(breakpoints.begin(),breakpoints.end()), ++ breakpoints.end()); ++ const auto distanceSquared=[&](double t) ++ { ++ double result=0.0; ++ for(std::size_t axis=0;axis<3;++axis) ++ { ++ const double position=segmentA[axis]+direction[axis]*t; ++ const double gap=positionprimitive.boundsMaximumMicrometres[axis] ++ ?position-primitive.boundsMaximumMicrometres[axis]:0.0; ++ result+=gap*gap; ++ } ++ return result; ++ }; ++ double closestSquared=std::min(distanceSquared(0.0),distanceSquared(1.0)); ++ for(std::size_t index=1;indexprimitive.boundsMaximumMicrometres[axis]) ++ {boundary=primitive.boundsMaximumMicrometres[axis];active=true;} ++ if(!active)continue; ++ quadratic+=direction[axis]*direction[axis]; ++ linear+=direction[axis]*(segmentA[axis]-boundary); ++ } ++ if(quadratic>1.0e-18) ++ { ++ const double closest=std::clamp(-linear/quadratic,low,high); ++ closestSquared=std::min(closestSquared,distanceSquared(closest)); ++ } ++ closestSquared=std::min(closestSquared,distanceSquared(low)); ++ closestSquared=std::min(closestSquared,distanceSquared(high)); ++ } ++ return closestSquared<=envelopeRadius*envelopeRadius; ++ } ++} ++ ++bool IsResolvedLayoutPrimitiveOutsidePassageEnvelopeV1( ++ const ResolvedLayoutSnapshotV3& layout, ++ const ResolvedLayoutPrimitiveBoundsV1& primitive, ++ std::string& conflictingPassageStableId) ++{ ++ conflictingPassageStableId.clear(); ++ for(std::size_t axis=0;axis<3;++axis) ++ if(primitive.boundsMinimumMicrometres[axis] ++ >primitive.boundsMaximumMicrometres[axis]) ++ {conflictingPassageStableId="invalid-primitive-bounds";return false;} ++ if(primitive.mouthJointRadiusMicrometres<0 ++ ||primitive.mouthJointRadiusMicrometres ++ >ResolvedPassageMouthJointRadiusMicrometresV1) ++ {conflictingPassageStableId="invalid-mouth-joint-radius";return false;} ++ ++ const auto envelope=BuildResolvedPassageEnvelopeSegments(layout); ++ bool matchedMouthJoint=primitive.mouthJointPassageStableId.empty(); ++ for(const auto& segment:envelope) ++ { ++ const bool isUpper=primitive.strateIndex==segment.upperStrateIndex; ++ const bool isLower=primitive.strateIndex==segment.lowerStrateIndex; ++ if(!isUpper&&!isLower)continue; ++ const bool authorized=primitive.mouthJointPassageStableId==segment.stableId; ++ if(authorized)matchedMouthJoint=true; ++ const double radius=segment.radiusMicrometres ++ +ResolvedPassageInfluenceReachMicrometresV1+1000.0; ++ const auto rejectAt=[&](double t) ++ { ++ conflictingPassageStableId=segment.stableId; ++ const std::array center{ ++ std::lerp(segment.a[0],segment.b[0],t), ++ std::lerp(segment.a[1],segment.b[1],t), ++ std::lerp(segment.a[2],segment.b[2],t)}; ++ const auto mouthDistance=[&](const auto& mouth) ++ { ++ const double dx=center[0]-mouth[0],dy=center[1]-mouth[1], ++ dz=center[2]-mouth[2]; ++ return std::sqrt(dx*dx+dy*dy+dz*dz)/1.0e6; ++ }; ++ std::printf("[PassageExclusionConflictDetail] primitive=%s passage=%s station_m=%.3f authorized_joint=%s joint_radius_m=%.3f envelope_radius_m=%.3f nearest_mouth_m=%.3f center_m=(%.3f,%.3f,%.3f) bounds_min_m=(%.3f,%.3f,%.3f) bounds_max_m=(%.3f,%.3f,%.3f)\n", ++ primitive.stableId.c_str(),segment.stableId.c_str(), ++ (segment.alongMicrometres+segment.lengthMicrometres*t)/1.0e6, ++ authorized?"true":"false", ++ primitive.mouthJointRadiusMicrometres/1.0e6,radius/1.0e6, ++ std::min(mouthDistance(segment.upperMouthCenter), ++ mouthDistance(segment.lowerMouthCenter)), ++ center[0]/1.0e6,center[1]/1.0e6,center[2]/1.0e6, ++ primitive.boundsMinimumMicrometres[0]/1.0e6, ++ primitive.boundsMinimumMicrometres[1]/1.0e6, ++ primitive.boundsMinimumMicrometres[2]/1.0e6, ++ primitive.boundsMaximumMicrometres[0]/1.0e6, ++ primitive.boundsMaximumMicrometres[1]/1.0e6, ++ primitive.boundsMaximumMicrometres[2]/1.0e6); ++ return false; ++ }; ++ const auto overlaps=[&](double t0,double t1) ++ { ++ if(t1<=t0)return false; ++ std::array a{},b{}; ++ for(std::size_t axis=0;axis<3;++axis) ++ { ++ a[axis]=std::lerp(segment.a[axis],segment.b[axis],t0); ++ b[axis]=std::lerp(segment.a[axis],segment.b[axis],t1); ++ } ++ return ResolvedPrimitiveBoundsOverlap(primitive,a,b,radius); ++ }; ++ if(authorized&&primitive.mouthJointRadiusMicrometres>0) ++ { ++ const auto& center=isUpper?segment.upperMouthCenter:segment.lowerMouthCenter; ++ std::array delta{}; ++ double quadratic=0.0,linear=0.0,constant=0.0; ++ for(std::size_t axis=0;axis<3;++axis) ++ { ++ delta[axis]=segment.b[axis]-segment.a[axis]; ++ const double offset=segment.a[axis]-center[axis]; ++ quadratic+=delta[axis]*delta[axis]; ++ linear+=offset*delta[axis]; ++ constant+=offset*offset; ++ } ++ const double jointReach=primitive.mouthJointRadiusMicrometres+radius; ++ constant-=jointReach*jointReach; ++ const double discriminant=linear*linear-quadratic*constant; ++ if(quadratic<=1.0e-18) ++ { ++ // A degenerate segment that is wholly in the joint is authorized; ++ // one outside it remains subject to the full envelope check. ++ if(constant<=0.0)continue; ++ if(overlaps(0.0,1.0)) ++ return rejectAt(0.5); ++ continue; ++ } ++ if(discriminant<0.0) ++ { ++ if(overlaps(0.0,1.0)) ++ return rejectAt(0.5); ++ continue; ++ } ++ const double root=std::sqrt(discriminant); ++ const double insideFirst=(-linear-root)/quadratic; ++ const double insideLast=(-linear+root)/quadratic; ++ const double clippedFirst=std::clamp(insideFirst,0.0,1.0); ++ const double clippedLast=std::clamp(insideLast,0.0,1.0); ++ if(insideFirst>=1.0||insideLast<=0.0) ++ { ++ if(overlaps(0.0,1.0)) ++ return rejectAt(0.5); ++ continue; ++ } ++ if(overlaps(0.0,clippedFirst)||overlaps(clippedLast,1.0)) ++ return rejectAt(clippedFirst>0.0?clippedFirst*0.5: ++ (1.0+clippedLast)*0.5); ++ continue; ++ } ++ if(overlaps(0.0,1.0)) ++ return rejectAt(0.5); ++ } ++ if(!matchedMouthJoint) ++ {conflictingPassageStableId=primitive.mouthJointPassageStableId;return false;} ++ return true; ++} ++ ++ResolvedLayoutPassageExclusionAuditV1 AuditResolvedLayoutPassageExclusionV1( ++ const ResolvedLayoutSnapshotV3& layout, ++ std::span primitives) ++{ ++ ResolvedLayoutPassageExclusionAuditV1 result; ++ for(const auto& primitive:primitives) ++ { ++ ++result.primitivesChecked; ++ if(!primitive.mouthJointPassageStableId.empty()) ++ ++result.mouthJointAssociations; ++ std::string conflict; ++ if(!IsResolvedLayoutPrimitiveOutsidePassageEnvelopeV1(layout,primitive,conflict)) ++ { ++ ++result.overlapsOutsideJoint; ++ if(result.firstOverlappingPrimitive.empty()) ++ { ++ result.firstOverlappingPrimitive=primitive.stableId; ++ result.firstOverlappingPassage=std::move(conflict); ++ } ++ } ++ } ++ ++ const auto passage=std::find_if(layout.passages.begin(),layout.passages.end(), ++ [](const auto& value){return value.controlPoints.size()>=2;}); ++ if(passage!=layout.passages.end()&&layout.coreVoxelSizeMicrometres>0) ++ { ++ const auto& point=passage->controlPoints[passage->controlPoints.size()/2] ++ .positionSubvoxels; ++ ResolvedLayoutPrimitiveBoundsV1 control; ++ control.stableId="negative-control/forced-inside-passage-envelope"; ++ control.strateIndex=passage->lowerStrateIndex; ++ const double scale=static_cast(layout.coreVoxelSizeMicrometres) ++ /WorldAssemblySubvoxelsPerVoxel; ++ for(std::size_t axis=0;axis<3;++axis) ++ { ++ const auto center=static_cast(std::llround(point[axis]*scale)); ++ control.boundsMinimumMicrometres[axis]=center-250000; ++ control.boundsMaximumMicrometres[axis]=center+250000; ++ } ++ ++result.negativeControlsRun; ++ std::string conflict; ++ if(!IsResolvedLayoutPrimitiveOutsidePassageEnvelopeV1(layout,control,conflict) ++ &&conflict==passage->stableId) ++ ++result.negativeControlsRejected; ++ } ++ result.passed=result.overlapsOutsideJoint==0 ++ &&result.negativeControlsRun==1 ++ &&result.negativeControlsRejected==result.negativeControlsRun; ++ return result; ++} ++ + bool PlanResolvedCavernNetworkV1(const ResolvedLayoutSnapshotV3& layout, + std::int32_t seed,std::int32_t strateIndex, + const ResolvedCavernPlannerSettingsV1& settings, +@@ -3484,6 +3779,127 @@ bool PlanResolvedCavernNetworkV1(const ResolvedLayoutSnapshotV3& layout, + std::atan2(static_cast(rise),static_cast(run)) + *180.0/3.14159265358979323846); + } ++ auto boundedGraph=layout; ++ std::string boundsError; ++ if(!ResolveResolvedCavernGraphV1(boundedGraph,seed,rooms,edges,boundsError)) ++ {error="cavern planner could not validate primitive bounds: "+boundsError;return false;} ++ std::vector primitiveBounds; ++ primitiveBounds.reserve(boundedGraph.cavernRooms.size()+boundedGraph.cavernEdges.size()); ++ const std::int64_t mouthJointFeatureSpanMicrometres= ++ MouthOverlap+PortalLeadLength+2*settings.destinationRadiusMicrometres; ++ const auto mouthJointAtProfileDistance=[&](std::int64_t distance) ++ ->std::string ++ { ++ if(distance<=mouthJointFeatureSpanMicrometres) ++ return arrivalPassage->stableId; ++ if(departurePassage&&totalRouteLength-distance ++ <=mouthJointFeatureSpanMicrometres) ++ return departurePassage->stableId; ++ return {}; ++ }; ++ const auto associateSpatialMouthJoint=[&](ResolvedLayoutPrimitiveBoundsV1& bounds) ++ { ++ if(!bounds.mouthJointPassageStableId.empty())return; ++ const double jointRadius= ++ static_cast(ResolvedPassageMouthJointRadiusMicrometresV1); ++ double nearestSquared=jointRadius*jointRadius; ++ for(const auto& passage:layout.passages) ++ { ++ if(bounds.strateIndex!=passage.upperStrateIndex ++ &&bounds.strateIndex!=passage.lowerStrateIndex) ++ continue; ++ if(passage.controlPoints.size()<2)continue; ++ const std::size_t lowerMouthIndex=std::min( ++ passage.lowerMouthControlIndex,passage.controlPoints.size()-1); ++ const std::array mouthIndices={0,lowerMouthIndex}; ++ double passageDistanceSquared=std::numeric_limits::infinity(); ++ for(const auto mouthIndex:mouthIndices) ++ { ++ double distanceSquared=0.0; ++ for(std::size_t axis=0;axis<3;++axis) ++ { ++ const double center=static_cast(qToMicrometres( ++ passage.controlPoints[mouthIndex].positionSubvoxels[axis])); ++ const double gap=centerbounds.boundsMaximumMicrometres[axis] ++ ?center-bounds.boundsMaximumMicrometres[axis]:0.0; ++ distanceSquared+=gap*gap; ++ } ++ passageDistanceSquared=std::min(passageDistanceSquared,distanceSquared); ++ } ++ if(passageDistanceSquared<=nearestSquared) ++ { ++ if(bounds.mouthJointPassageStableId.empty() ++ ||passageDistanceSquared=0) ++ bounds.mouthJointPassageStableId=mouthJointAtProfileDistance( ++ room.floorProfileDistanceMicrometres); ++ if(!bounds.mouthJointPassageStableId.empty()) ++ bounds.mouthJointRadiusMicrometres= ++ ResolvedPassageMouthJointRadiusMicrometresV1; ++ associateSpatialMouthJoint(bounds); ++ primitiveBounds.push_back(std::move(bounds)); ++ } ++ const auto mouthJointForAnchor=[](const std::string& anchor) ++ { ++ constexpr std::string_view Lower="/lower-mouth"; ++ constexpr std::string_view Upper="/upper-mouth"; ++ if(anchor.ends_with(Lower))return anchor.substr(0,anchor.size()-Lower.size()); ++ if(anchor.ends_with(Upper))return anchor.substr(0,anchor.size()-Upper.size()); ++ return std::string{}; ++ }; ++ for(const auto& edge:boundedGraph.cavernEdges) ++ { ++ ResolvedLayoutPrimitiveBoundsV1 bounds{edge.stableId,edge.strateIndex, ++ edge.boundsMinimumMicrometres,edge.boundsMaximumMicrometres}; ++ bounds.mouthJointPassageStableId=mouthJointForAnchor(edge.startAnchorStableId); ++ if(bounds.mouthJointPassageStableId.empty() ++ &&edge.floorProfileStableId==backboneFloorProfileId ++ &&edge.floorProfileStartDistanceMicrometres>=0 ++ &&edge.floorProfileEndDistanceMicrometres>=0) ++ { ++ const auto midpoint=(edge.floorProfileStartDistanceMicrometres ++ +edge.floorProfileEndDistanceMicrometres)/2; ++ bounds.mouthJointPassageStableId=mouthJointAtProfileDistance(midpoint); ++ } ++ if(!bounds.mouthJointPassageStableId.empty()) ++ bounds.mouthJointRadiusMicrometres= ++ ResolvedPassageMouthJointRadiusMicrometresV1; ++ associateSpatialMouthJoint(bounds); ++ primitiveBounds.push_back(std::move(bounds)); ++ } ++ const auto exclusionAudit=AuditResolvedLayoutPassageExclusionV1(layout,primitiveBounds); ++ std::printf("[CavernPassageExclusionAudit] strate=%d primitives=%llu outside_joint=%llu mouth_joint=%llu negative_controls=%u/%u first_primitive=%s first_passage=%s status=%s\n", ++ strateIndex,static_cast(exclusionAudit.primitivesChecked), ++ static_cast(exclusionAudit.overlapsOutsideJoint), ++ static_cast(exclusionAudit.mouthJointAssociations), ++ exclusionAudit.negativeControlsRejected,exclusionAudit.negativeControlsRun, ++ exclusionAudit.firstOverlappingPrimitive.empty()?"none":exclusionAudit.firstOverlappingPrimitive.c_str(), ++ exclusionAudit.firstOverlappingPassage.empty()?"none":exclusionAudit.firstOverlappingPassage.c_str(), ++ exclusionAudit.passed?"PASS":"FAIL"); ++ if(!exclusionAudit.passed) ++ { ++ error="cavern planner primitive bounds overlap a passage exclusion envelope outside its mouth joint: "+ ++ exclusionAudit.firstOverlappingPrimitive+" -> "+exclusionAudit.firstOverlappingPassage; ++ return false; ++ } + const double plannerMilliseconds=std::chrono::duration( + std::chrono::steady_clock::now()-plannerStarted).count(); + std::printf("[CavernPlannerV1] strate=%d seed=%d route=%s->%s route_nodes=%zu room_primitives=%zu shafts=%zu edges=%zu branches=%zu route_horizontal_m=%.3f floor_delta_m=%.3f max_grade_deg=%.3f mouth_tangent_min_dot=%.3f grade_limit_deg=11.310 clearance_radius_m=%.3f clearance_height_m=%.3f destination_radius_m=%.3f plan_ms=%.3f status=PASS\n", +diff --git a/Standalone/Source/StreamBenchmarkPipeline.h b/Standalone/Source/StreamBenchmarkPipeline.h +index 48b5a30..80677e3 100644 +--- a/Standalone/Source/StreamBenchmarkPipeline.h ++++ b/Standalone/Source/StreamBenchmarkPipeline.h +@@ -4709,6 +4709,19 @@ namespace StandaloneStreamBenchmark + const auto& route=allPassageSmoothRoutes[passageIndex]; + if(route.size()<2)return audit; + const double totalRouteLength=route.back().distance; ++ const double mouthJointRadiusMetres= ++ static_cast(VoxelForgeCore:: ++ ResolvedPassageMouthJointRadiusMicrometresV1)/1000000.0; ++ const auto insideMouthJoint=[&](double x,double y,double z) ++ { ++ const auto inside=[&](const auto& mouth) ++ { ++ const double dx=x-mouth.x,dy=y-mouth.y,dz=z-mouth.z; ++ return dx*dx+dy*dy+dz*dz ++ <=mouthJointRadiusMetres*mouthJointRadiusMetres; ++ }; ++ return inside(route.front())||inside(route.back()); ++ }; + const double bodyFloorDepth=allPassageBodyFloorDepths[passageIndex]; + constexpr std::array,5> floorOffsets{{ + {{0.0,0.0}},{{0.30,0.0}},{{-0.30,0.0}}, +@@ -4859,11 +4872,6 @@ namespace StandaloneStreamBenchmark + } + const double tangentLength=std::hypot(dx,dy); + if(tangentLength<=1.0e-6)continue; +- if(std::min(along,totalRouteLength-along)<5.0) +- { +- audit.wallMouthBlendSkips+=5; +- continue; +- } + const double nx=-dy/tangentLength,ny=dx/tangentLength; + const double floorDepth=passageTubeDepthAt(radius,bodyFloorDepth); + double floorZ=passageFloorAtXY(passageIndex,centerX,centerY, +@@ -4897,6 +4905,11 @@ namespace StandaloneStreamBenchmark + } + sampleZ=floorZ+probe.height; + } ++ if(insideMouthJoint(sampleX,sampleY,sampleZ)) ++ { ++ ++audit.wallMouthBlendSkips; ++ continue; ++ } + const VoxelForgeCore::Vec3d wallPosition{sampleX/coreMetres, + sampleY/coreMetres,sampleZ/coreMetres}; + if(passageInteriorWinsAt(sampleX,sampleY,sampleZ))