Skip to content

feat(room): draw the building's footprint instead of assuming a rectangle - #1823

Open
clonea1 wants to merge 5 commits into
ruvnet:mainfrom
clonea1:contrib/ui-room-builder-footprint
Open

feat(room): draw the building's footprint instead of assuming a rectangle#1823
clonea1 wants to merge 5 commits into
ruvnet:mainfrom
clonea1:contrib/ui-room-builder-footprint

Conversation

@clonea1

@clonea1 clonea1 commented Sep 4, 2026

Copy link
Copy Markdown

The Room Builder modelled a storey as width x depth. Most buildings are not
rectangles, and the ones that are not tend to be exactly where the interesting
propagation happens: a wing off the main block, an L around a stairwell, a
garage bay that swallows a link.

Adds a footprint editor. A storey is a polygon of points placed on the canvas
rather than two numbers, so a node in a wing has coordinates that mean
something relative to the building it is actually in, instead of being placed
in empty space outside an assumed rectangle.

Width and depth are kept as the polygon's bounding box, so existing configs and
anything reading those two fields keep working unchanged.


Rebased onto current main before opening: staged before today's seven merges, so it needed replaying to avoid reading as a revert of them. Clean rebase, no files deleted.

Joe and others added 5 commits September 4, 2026 15:02
New tab (index.html nav + section, wired in app.js following the same
container-lookup + component pattern as the other tabs) backed by
GET/POST /api/v1/config/room. A 2D top-down canvas: set room width/
depth, add/remove sensor nodes, drag them into place or type exact
X/Y/Z, save. Save applies immediately (live, no restart) and persists
to room_config.json, which future launches load automatically -
replacing the --node-positions CLI-only workflow.

Metric/imperial unit toggle (display-only - this.config and everything
sent to the API always stay in meters, remembered per-browser via
localStorage). Compass badge + explanatory text establishing (0,0,0)
as the room's Northwest corner, +X = East, +Y = South, so placements
can be oriented to the real room.

Rows are matched to their node by array index rather than by id -
id is itself one of the editable fields, and using it as the lookup
key meant renaming a node into an id already in use broke the row<->
node link (two rows silently reading/writing the same node object,
which looked like one node jumping onto or stacking with another).
Duplicate ids are now also caught client-side (warned while editing,
hard-blocked on save) ahead of the server's own validation, and a
server-side validation rejection (200 OK with an {"error": ...} body,
not a failure status) is now checked for explicitly rather than
silently treated as a successful save.

Co-Authored-By: claude-flow <ruv@ruv.net>
(cherry picked from commit 4cc202a)
Extracted POST /api/v1/config/room's validation into a pure
validate_room_config(&RoomConfig) -> Result<(), String> function so it's
unit-testable without a full SharedState/axum harness; behavior
unchanged, the handler just delegates to it now.

9 new tests: load-missing/malformed-file defaults, save+load round trip,
and validation for non-positive/non-finite dimensions, non-finite node
coordinates, duplicate node ids, and an empty node list.

Also adds a "Reload from Saved" button to the Room Builder UI (discards
unsaved local edits, re-fetches the live server config).

Co-Authored-By: claude-flow <ruv@ruv.net>
(cherry picked from commit a3b9907)
Extends the Room Builder from a single flat rectangle to a building: multiple
storeys, walls drawn per storey, and a placed access point.

Storeys share one origin. The origin (0, 0, 0) is the north-west corner of the
first floor at floor level, and every storey is measured from it rather than
being re-zeroed, so a node's X/Y means the same thing on every floor and
distances between nodes on different storeys are plain Euclidean. Nodes and
walls on other storeys are drawn faintly rather than hidden, which is what lets
an upper-floor node be lined up against the wall below it.

Storey elevation is derived from ceiling height plus subfloor thickness rather
than typed in directly, because those are the two numbers someone can actually
measure. Heights are entered in inches.

A node carries `floor` alongside `z`. That is redundant for geometry and
deliberately so: it is what the builder groups by and what walls are associated
with, and deriving it from `z` would guess wrong for a node mounted high in a
stairwell. `floor` is optional, so a config written before storeys existed keeps
working unchanged.

Every persisted field is served back by GET /api/v1/config/room. That response
body is hand-maintained and will not complain when it falls behind the struct,
so it carries a comment saying so at the point where the next field will be
added -- a field that is saved but not served looks exactly like "the setting
will not stick".

Wall entry takes a start and an end and refuses a zero-length wall, which is
otherwise easy to stage by double-tapping a corner.

Co-Authored-By: claude-flow <ruv@ruv.net>
…ngle

The Room Builder modelled a storey as width x depth. Most buildings are not
rectangles, and the ones that are not tend to be exactly where the interesting
propagation happens: a wing off the main block, an L around a stairwell, a
garage bay that swallows a link.

Adds a footprint editor. A storey is a polygon of points placed on the canvas
rather than two numbers, so a node in a wing has coordinates that mean
something relative to the building it is actually in, instead of being placed
in empty space outside an assumed rectangle.

Width and depth are kept as the polygon's bounding box, so existing configs and
anything reading those two fields keep working unchanged.

Co-Authored-By: claude-flow <ruv@ruv.net>
…al Vec

ruvnet#1791 landed node_positions_config as a positional Vec<[f32;3]> keyed by
active-node rank, not the HashMap<u8,[f32;3]> this branch was written against,
so the Room Builder handlers stopped compiling.

Read path enumerates and derives the id from the index, matching the convention
the fusion path uses. Write path builds the vector indexed BY node id before
assigning, so a sparse id set still lands each node in the right slot instead of
shifting everything after a gap.

Co-Authored-By: claude-flow <ruv@ruv.net>
@clonea1
clonea1 force-pushed the contrib/ui-room-builder-footprint branch from 2345a98 to b5a5db1 Compare September 4, 2026 20:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant