Band faces now use signed distance to the displaced solid intervals, continuous across bands, so MC interpolates the interface instead of terracing at density levels. The Gradient amplitude is restored to width/8 (about 4 m peak-to-peak at 16 m). Ring/terrace audit at LOD0-8 on the FI floor and SW ceiling passes; negative controls: L30 (rings) and L31 (flat) both fail. Hole/interface audits, 16 passage rows and 24/24 determinism pass. Evaluator 20. Cost vs L31 SW +1.9%, FI +1.5%. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01CSFYgsdW8ejZSyiMf4qRSX
59 lines
2.6 KiB
Python
59 lines
2.6 KiB
Python
#!/usr/bin/env python3
|
|
"""Dump a bounded surface line from a VFMSH scene using the ring-audit sampler."""
|
|
import argparse
|
|
import importlib.util
|
|
from pathlib import Path
|
|
import resource
|
|
|
|
|
|
def main():
|
|
parser = argparse.ArgumentParser()
|
|
parser.add_argument("scene")
|
|
parser.add_argument("--surface", choices=("floor", "ceiling"), required=True)
|
|
parser.add_argument("--center", nargs=2, type=float, required=True)
|
|
parser.add_argument("--radius", type=float, required=True)
|
|
parser.add_argument("--lod", type=int, required=True)
|
|
parser.add_argument("--height-min-m", type=float, required=True)
|
|
parser.add_argument("--height-max-m", type=float, required=True)
|
|
parser.add_argument("--line", choices=("x", "y", "diagonal"), default="x")
|
|
parser.add_argument("--stride-m", type=float, default=8.0)
|
|
args = parser.parse_args()
|
|
audit_path = Path(__file__).with_name("AuditRingTerraceL32.py")
|
|
spec = importlib.util.spec_from_file_location("ring_audit_l32", audit_path)
|
|
audit = importlib.util.module_from_spec(spec)
|
|
spec.loader.exec_module(audit)
|
|
cx, cy = args.center
|
|
bounds = (cx - args.radius, cx + args.radius,
|
|
cy - args.radius, cy + args.radius)
|
|
voxel_um, triangles, tiles = audit.read_scene(args.scene, args.lod,
|
|
args.height_min_m, args.height_max_m, bounds)
|
|
cell_size = max(2.0, 16.0 * voxel_um / 1_000_000.0 * (1 << args.lod))
|
|
buckets = audit.build_buckets(triangles, args.surface == "floor", bounds, cell_size)
|
|
count = round(2.0 * args.radius / args.stride_m)
|
|
print(f"[SurfaceProfile] lod={args.lod} surface={args.surface} tiles={tiles} "
|
|
f"triangles={len(triangles)} line={args.line} stride_m={args.stride_m}")
|
|
print("index,x_m,y_m,z_m,nx,ny,nz")
|
|
for index in range(count + 1):
|
|
t = -args.radius + index * args.stride_m
|
|
if args.line == "x":
|
|
x, y = cx + t, cy
|
|
elif args.line == "y":
|
|
x, y = cx, cy + t
|
|
else:
|
|
x, y = cx + t / 2.0**0.5, cy + t / 2.0**0.5
|
|
preferred_height = args.height_max_m if args.surface == "floor" else args.height_min_m
|
|
hit = audit.sample_surface(buckets, x, y, args.surface == "floor", cell_size,
|
|
preferred_height)
|
|
if hit is None:
|
|
print(f"{index},{x:.3f},{y:.3f},nan,nan,nan,nan")
|
|
else:
|
|
z, normal = hit
|
|
print(f"{index},{x:.3f},{y:.3f},{z:.6f}," +
|
|
",".join(f"{value:.7f}" for value in normal))
|
|
print(f"[SurfaceProfileRSS] peak_rss_kib="
|
|
f"{resource.getrusage(resource.RUSAGE_SELF).ru_maxrss}")
|
|
|
|
|
|
if __name__ == "__main__":
|
|
main()
|