Clean-room Python successor to Urb for programme-driven layout search.
This initial commit establishes the .dom bridge format and a faithful
port of Urb's top-down quad geometry, validated byte-identical against
Urb across all 35 programme-house example files (including the wall
inset and multi-storey wall-stacking inheritance).
- dom.py: .dom YAML <-> Node tree, parent/below/position linkage,
wall_outer inset on load, raw-corner stash for round-tripping
- geometry.py: Coordinate/Coordinate_a/_b/Area/Length + Coordinate_Offset
- experiments/dump_areas.{py,pl}: geometry regression harness
23 lines
669 B
Perl
23 lines
669 B
Perl
#!/usr/bin/perl
|
|
# Dump per-leaf areas from a .dom using Urb itself (ground truth for validating
|
|
# the Python geometry port). Run from the urb repo root with -Ilib.
|
|
# Output matches experiments/dump_areas.py: "level/idpath type area", sorted.
|
|
use strict;
|
|
use warnings;
|
|
use YAML;
|
|
use Urb::Dom;
|
|
|
|
my $dom = Urb::Dom->new;
|
|
$dom->Deserialise (YAML::LoadFile ($ARGV[0]));
|
|
|
|
my @rows;
|
|
for my $level ($dom, $dom->Levels_Above)
|
|
{
|
|
my $lid = scalar $level->Levels_Below;
|
|
for my $leaf ($level->Leafs)
|
|
{
|
|
my $type = $leaf->Type || '?';
|
|
push @rows, sprintf ("%d/%s %s %.4f", $lid, $leaf->Id, $type, $leaf->Area);
|
|
}
|
|
}
|
|
print join ("\n", sort @rows), "\n";
|