roomInputOf function
h's input to the tracer from its component params and its group's
accumulated transform toWorld (spec 10 D4): the one function both
adapters call.
WallParams: the wall's uncut band, localOutlineOf amongwalls(its wall neighbours, ascending) taken to world throughtoWorld-- the ring 07 stores for the wall when it has no openings, so a doorway, a window or a gap never breaks a room (R-5: the local ring, not 07's world outline, so the band traced is the one drawn). None for 07 D2's degenerate wall (an empty ring).SeparatorParams: its world segment, open. None when its length is not more thanroomTrace.linearor an endpoint is not finite (D3's degenerate separator).- anything else: none. Boxes and openings are not inputs.
A result with a non-finite coordinate is none (S-6).
Implementation
RoomInput? roomInputOf(Handle h, Component params, Transform2 toWorld,
{List<WorldWall> walls = const []}) {
switch (params) {
case final WallParams p:
final ring = localOutlineOf(WorldWall(h, p, toWorld), walls).ring;
if (ring.isEmpty) return null;
final world = [for (final q in ring) toWorld.transformPoint(q)];
if (!world.every(_finite)) return null;
return RoomInput(h, world, closed: true);
case final SeparatorParams p:
final s = toWorld.transformPoint(p.start);
final e = toWorld.transformPoint(p.end);
if (!_finite(s) || !_finite(e)) return null;
if (!((e - s).length > roomTrace.linear)) return null;
return RoomInput(h, [s, e], closed: false);
default:
return null;
}
}