Part of the architecture notes indexed in AGENTS.md. Keep each topic in its bullet here; AGENTS.md only lists the topics.
ModelGeometry::build whenever the document revision changes. Walls attached to a roof, ceiling or floor (Wall::attach_top) follow it: attach_wall_tops (after the slabs) gives a straight wall’s WallGeom a top_profile along its centerline, from the planes of the target’s faces turned down (reaching half the wall past them, breaking where the centerline crosses their edges or two planes cross), splits its columns there and rebuilds its solid (IFC export cuts the body by the planes of those segments, see cc_ifc); EditCtx::finish → sync_attachments drops references to deleted targets. Walls: joins are resolved per level, among the walls that overlap in height, on the body centerline (Project::wall_axis, which applies the wall’s LocationLine and the type’s core layers); an arc wall (Wall::bulge, see cc_core::arc) keeps a concentric centerline, its WallGeom::arc maps wall-local (u, v) (along the arc, to its left) to the plan, faces meet neighbors at the true crossings of their lines and circles, plans draw arcs as short chords and solids mark their curved facets Face::smooth (no seams, silhouettes only); base/top come from Project::wall_base_z/wall_top_z (top may be attached to a level). Walls meet where their drawn location lines end (WallLine::drawn). At a T, a layered wall’s structure core (WallGeom::core) runs on through the outer layers of the wall it meets to that wall’s core (core_through → WallGeom::core_ends, the host’s layer_gaps), and plans draw the cleanup (layer_span, layer_pieces, boundary_segments; no line between cores of one material); bodies, volumes and 3D views are unchanged. WallGeom holds columns between openings; per-wall volume is analytic (the body solid omits caps at joins). opening_parts gives the pieces of a door or window (component pieces, or the boxes of hosted_parts for old fixed types) shared by the 3D view, plans and IFC. Pitched roofs come from the weighted straight skeleton in skeleton.rs (a wavefront simulation with edge and split events: sloped eaves move in at 1 / slope, gables stay; Roof::edge_slopes overrides the slope or makes a gable per outline edge; Roof::edge_overhangs (serde default, repaired like the slopes, set by roof_edge_set’s overhang, kept by mirrors since roofs keep their point order, cleared with the slopes by sketch_set when the point count changes) gives an edge its own overhang: roofs::outline grows the footprint per edge (mitered; a gable step between collinear edges of different overhangs; exactly polygon::offset when no edge has one) and is the slab outline everywhere (build, plan view, plan_area, IFC flat and shed roofs); the planes stay where the roof’s overhang puts them (base_offset is the eave tip at that overhang, so each sloped plane passes its wall line at base_offset + slope × overhang), an edge’s eave sits slope × (overhang − own) above the base, and roofs::eave_starts turns that into start heights over the lowest eave: skeleton_with_starts holds such an edge still like a gable until the wavefront reaches its height (a start event; Skeleton::late_eaves for its eave strip, Plane::start in its heights), shed roofs keep their plane with roofs::shed_low, and the fallback moves its eaves with roofs::raise_eaves; faces per plane, hips, valleys and ridges; bounded, errors as values, the old lowest-plane construction as fallback), over outlines with openings (Roof::holes); roofs.rs builds the slab. rooms.rs finds a room boundary by tracing the face of the wall-footprint arrangement around the room point. Beams (and strip footings) resolve their ends in beam.rs: an end inside a structural column stops at its face, other ends reuse the wall joins (resolve_join) among beams at a common depth; a beam (Beam::bulge, level only: repair and the commands drop the slope of an arc beam; Project::beam_axis moves a justified arc onto a concentric one) and a strip footing (FoundationShape::Strip::bulge) may bend, the bulge passed into their WallLine: BeamGeom::arc maps local (u, v) like WallGeom::arc (dir_at, locate, axis, and outline for the chorded plan outline, footprint being the four corners only), an arc beam’s end frames into a column where each of its sides leaves the column on its own circle (arc_exit), its section is swept in chords (add_to: curved sides smooth) and its volume is exact (in ModelGeometry::curved_volumes), and FoundationGeom::arc holds a StripArc (strip.rs: chorded outline, exact area and volume, smooth facets); section.rs turns column and beam sections (a type’s structural profile, see Structural profiles, or its legacy fixed section) into non-overlapping parts and outlines; analytical.rs builds the analytical model (members between shared nodes) from columns and ModelGeometry::beams (a beam end running over a column ends on its axis, and a column end at a beam that passes it ends on the beam’s line and is no support, so a truss’s cut posts and run-on chords still meet at the panel points; an arc beam’s line keeps its arc (Line::curve, refit through the ends by fit_arc when they move), ends landing on it and nodes splitting it lie on the arc, and each of its Members carries the bulge of its own part of the arc: AnalyticalModel::arc, length (along the arc) and points (chorded, which the analytical 3D views of cc_views and cc_render draw), and split_arcs(n) replaces each curved member by n straight ones between new nodes on the arc); rebar.rs lays out the bars of each Rebar set (an element hosted by a beam or column, removed with it) in its host: RebarLayout::Longitudinal bars (in a beam, those that do not fit side by side at clear_distance go in further layers), Sides (side bars on both side faces of a beam, by count or by spacing over the height) and Stirrups; along an arc beam the bars follow the arc as chords with their Bar::true_length the arc’s at their own radius, and the stirrups are radial; Rebar::splice (cc_core::Splice: max_length, lap; pieces cuts a longer bar in the fewest equal pieces, odd bars half a piece off) lap splices the bars along a beam; Rebar::anchorage runs them on into the columns and pile caps the beam’s ends frame into (Supports from build::support_input, the supports build_beams frames beams into; anchor_end along the bar’s own line or circle up to the far face less the cover, at most the anchorage, a vertical hook leg where short, half a lap past the middle of a support between beams in line; BeamRun the developed bar spliced after; see Anchorage of beam bars in reinforcement.md); a column’s bars stand around its section through cc_geom::faces (SectionFaces inset inside it, counter-clockwise: sector_faces exact arcs and radial sides of an annular sector, outline_faces the sides of any outline between its corners, a circle one closed face; face_bars puts a bar at every corner and those of Rebar::faces (FaceBars: a count with the two corners, or a spacing) between them, at even angles on an arc, or spreads a count; face_loop is a tie’s center line with its true length; across finds where a cross-tie lands: straight across, or square to the bisector of two leaning faces): a plain box or round section with no faces keeps the older perimeter/circle layout, Stirrups follow the outline, RebarLayout::Ties are hooked straight bars from each bar between corners of the host’s first longitudinal set to the bar opposite (none where the line would leave the cage), and a column’s splice cuts every vertical bar in the same lifts, every other bar around the section Splice::stagger higher (Rebar::column_pieces, around_parity) (rebar::column_faces gives a type’s faces to the commands); a wall’s sets (RebarLayout::WallHorizontal { side: WallSide, zones: Vec<SpacingZone>, inner }, WallVertical { side, spacing, offset, from, to, bottom, top: BarEnd, inner } and WallTies { every_horizontal, every_vertical }, so RebarLayout is Clone, not Copy; is_valid, in_wall; repair keeps wall layouts in walls and the others in beams and columns) are laid out by cc_geom::wall_rebar from the WallGeom: bars cover inside the faces of the wall’s core (inner sets a bar of the other family further in), horizontal bars at levels over each stretch solid at their height (solid_runs from the wall’s columns, so they stop around openings; no cover at an end joined to another wall), following an arc wall with their true length, vertical bars at stations along the centerline over the solid heights with bent ends (BarEnd: a leg across the wall, then one along the bar) on the bar’s own ends only, both spliced by Rebar::splice, and ties across the wall at every n-th level and station of the exterior face’s sets; a pile cap’s and a pile’s sets are laid out by cc_geom::cap_rebar (by family role for whatever layout the cap’s type has: bands between piles, bars along a line of piles, a mesh, side loops and stirrups of a beam-like cap; Region clips lines to the outline less the inset, exactly on a disk or a ring) and cc_geom::pile_rebar (bars around the section up into the cap, ties, and a spiral: one bar whose Bar::helix is its coil, true_length exact; see Pile caps and piles in reinforcement.md), build_rebar taking ModelGeometry::piles; and it places shaped bars (ElementKind::ShapedRebar: center lines in plan x/y and z above the level, no host, the type’s diameter, imported property sets; what IFC import makes of an IfcReinforcingBar drawn as swept disks, typed by diameter and grade, and export writes back) where they are drawn, both in ModelGeometry::rebar for schedules, 3D and export.Renderer3D); render_to_rgba reads a frame back (home screen thumbnails). Edge lines are the solids’ outlines (Solid::feature_edges) plus the edges between the smooth facets of curved surfaces (Solid::smooth_edges, each once, as Vertex::seam: the other facet’s normal in fg, the edge’s middle in bg, a mark in tex.w), which the edge shader (vs_edge, with the viewer’s place in Uniforms::eye) draws only as silhouettes: where one facet is turned to the viewer and the other away.cc_geom::join_pieces (solid.rs), run by ModelGeometry::build over the solids of each placed component and of each door or window, lets them read as one body. Pieces of one element alike in material, color, transparency and detail levels (Solid::alike) that lie against each other on a whole face (the same points, within 0.01 mm, turned against each other) are joined when the body bends at one of those seams: faces of the two pieces meet along it at less than the angle of SMOOTH_COS without lying in one plane; every piece reached over such seams from a bent one is joined too, so the straight stretches of the body follow. Pieces that only stand side by side (boards, doors, tiles) bend nowhere and keep the lines between them. Joined pieces keep their own faces (volumes, picking, sections, IFC and paint are unchanged; a painted solid is not joined): each gets in Solid::joined the faces of its neighbors at the seams (the face it lies against and the faces around it), and the faces that bend at a seam become Face::smooth. Solid::feature_edges, smooth_edges and vertex_normals count the joined faces as the solid’s own neighbors (edges of the joined faces themselves are never returned), so no view draws the seams, the facets shade together and silhouettes are found across them; a face lying against a joined face hides all its edges, and Solid::inner_faces lists those faces, which cc_render’s Tessellation does not triangulate.