Part of the architecture notes indexed in AGENTS.md. Keep each topic in its bullet here; AGENTS.md only lists the topics.
cc_core::sketch: a Sketch is the SketchCurves (lines, bulge arcs, circles, whole or partial ellipses, splines: SketchCurve::Spline holds the control points of a chain of cubic Béziers, cc_core::spline interpolates the points clicked and splits, offsets and measures them exactly, and component profile points carry them as ProfilePoint::bezier handles, profile::Segment::Bezier) an outline was drawn with; Sketch::profile chains them into loops (ends within JOIN_TOL, bounded, arcs and ellipses split every ARC_STEP) and returns the outline and its openings, or a SketchError with the point (open end, branch, crossing, apart, nested, openings where none are allowed). Floors, ceilings, roofs and masses keep theirs in an optional sketch field (Element::drawn_sketch, sketched_profile); Element::transform/translate move it, and EditCtx::finish (sync_sketches) and repair drop one that no longer makes the outline (Sketch::makes), so editing the points directly leaves the curves behind. A floor’s area (Floor::area) and volume (ModelGeometry::curved_volumes) follow the true curves of a curved sketch (Sketch::area, SketchCurve::swept_area), not the chords of its outline; IFC import keeps the circles and arcs of a slab’s profile (IfcCircleProfileDef, trimmed circles and arc segments in IfcArbitraryClosedProfileDef, Geometry::plan_curves) as the floor’s sketch, and export writes a curved sketch’s circles and arcs as such (Sketch::curve_profile gives each loop’s curves in order, #368). cc_engine::commands::sketch: CurveArg (also rectangles and polygons, as lines) is the curves argument of floor_create, ceiling_create, roof_create, foundation_slab_create (outline only, not kept) and mass_create; sketch_get and sketch_set read and redraw an outline. In the app, sketch_mode holds the open sketch (AppState::sketch, opened by set_tool with a Tool::Sketch, or by Edit Boundary): its own ribbon (drawing tools, Finish/Cancel), the canvas (preview, snapping to the sketch’s points, picking, grips that move joined ends together), the picked curve in the properties palette and its own undo, window and chain selection, and the Modify tools (move, copy, rotate, mirror, offset, trim/extend, split: the same UiCommands, routed to the sketch while one is open, the geometry in cc_core::sketch_edit); Finish runs the creation command with curves or sketch_set. The component environment’s pieces are sketched in the same session (Target::Piece, Session::piece; component_sketch snaps to its reference planes and writes the curves as profile points, locked to planes, keeping the expressions of points that did not move when a piece’s sketch is edited).cc_core::roofing: TypeData::Roof { covering, framing } (serde defaults): a TileKind from the built-in catalog (TileKind::spec: least slope, weight, tiles per m², batten gauge, purlin span) and a RoofFraming (system None/Timber/TimberTrusses/Steel, material, purlin/rafter/batten MemberSizes and spacings, repaired on load). cc_geom::roof_framing frames each sloped underside plane of the roof’s built solid (so it follows Roof::edge_overhangs, see geometry.md), coplanar pieces together (battens at the gauge, rafters down the slope, purlins spread evenly; trusses: also king-post trusses across the eave direction of the largest face, cut from the faces sloping across them moved under the purlins, chords met at the apex, chords apart making separate trusses; steel: purlins only), as boxes across the roof plane; build_slabs stores it in ModelGeometry::roof_framing and adds the members as a Category::Beam solid of the roof element marked Solid::secondary: drawn, but left out of ModelGeometry::body_of (volume, joins, plan edges, IFC body), and section cuts hatch it in the framing’s material. The covering’s rules (TileSpec::accepts, tiles, weight_on) are shared by the check, properties and schedules; type_set gives a new covering the framing it usually lies on when none was chosen. roof_check and element_get’s roofing give the slope against the covering’s least, tiles, weight and framing figures; schedules have TileCount, FramingLength, FramingVolume, and Slope/Weight for roofs. IFC export writes each member as an IfcMember (kind from MemberKind and Member::truss) aggregated in the IfcRoof, typed by an IfcMemberType per roof type and member name, and the type’s choices in ROOFING_PSET (ConstructCAD_Roofing); import restores them on the roof’s type (Importer::roofing) and leaves out the members aggregated in a roof so framed (framed_roofs).cc_core::mass: ElementKind::Mass(Mass) (category Mass, a TypeData::Mass { material } type created with the first mass) is a base outline extruded height up from its level plus base_offset, or lofted to a top outline (cc_core::sweep::blend; outlines with as many points join vertex to vertex, so an inset is exact), with floors, the levels where mass floors are taken. cc_geom::mass builds the see-through body and the mass floors (Mass::section at each listed level the mass spans, with area and perimeter; ModelGeometry::masses); plans draw a mass where it stands or is cut (draw_mesh) with the floor of their level and its area; schedules have FloorArea and FloorCount. cc_engine::commands::mass holds mass_create (with top or top_inset for a loft), mass_floors_set, mass_floors and mass_type_create; deleting a level drops its mass floors. mass_walls_create, mass_slabs_create and mass_roof_create build walls (exterior face on the mass, LocationLine::FinishExterior, outline run clockwise), floors on the mass floors and a flat roof from a mass. IFC export leaves masses out, like imported drawings.cc_core::topography: ElementKind::Topography(Topography) (category Topography, a TypeData::Topography { material, contour_interval, major_every } type created with the first terrain, in the earth material the template carries or topography_create adds) holds measured points (z above the level), a closed boundary (with an optional sketch) and base_depth; repair drops bad and repeated points, and its defaults and limits are the module’s constants (DEFAULT_*, MIN_CONTOUR_INTERVAL, EARTH_COLOR, earth_material). cc_geom::topography triangulates the points inside the boundary with its edges as constraints (spade, constrained Delaunay, inside catch_unwind), gives the boundary the elevations all the points imply (barycentric, else the nearest point), closes the surface down to a flat base into a solid (ModelGeometry::topographies, analytic volume) and cuts contours; cc_views::topography draws plans (contours below the cut, the earth above it hatched). cc_engine::commands::topography holds topography_create, topography_points_set and topography_type_create; IFC export writes an IfcGeographicElement TERRAIN with TOPOGRAPHY_PSET (ConstructCAD_Topography), which import reads back. sketch_set takes a terrain’s points with its curves (one step). In the app the sketch takes points (Draw::Point at ModifyOptions::point_elevation, sketch_mode::Session::points, picked and deleted with the curves).cc_core::pad: ElementKind::Pad(Pad) (category Pad, a TypeData::Pad { cut_slope, fill_slope } type created with the first pad; ratios are run per unit of rise, kept in MIN_SLOPE..=MAX_SLOPE) is a flat outline at elevation above its host terrain’s level, with optional own slopes. Repair drops a pad whose host is not a terrain; EditCtx::finish → sync_pads keeps its level the host’s; it is deleted (remove_element), transformed and copied with its terrain (Project::pads_of). cc_geom::pad::grade applies each pad of a terrain in id order to pad::Surface (topo_geom_with_pads): F = max(L, min(T, C)) over the triangles within reach of the pad, re-triangulated with spade with their edges as constraints (split where the outline and daylight lines cross them; new points settled off slivers, Index::settle), so cut and fill integrate exactly; TopoGeom::existing keeps the original ground where pads changed it, ModelGeometry::pads the PadGeoms (volumes, daylight lines, slope rays, warnings). cc_views::topography draws the pad (outline, elevation, slope ticks, daylight, the existing contours dashed) and sections dash the existing ground line (projected::existing_ground). cc_engine::commands::pad holds pad_create (default_host) and pad_type_create; IFC export writes a terrain’s pads in PADS_PSET (ConstructCAD_Pads), import recreates them. In the app: Massing & Site → Site → Building Pad (ModifyOptions::pad_elevation, available when the plan’s level has a terrain).cc_core::shaft: ElementKind::Shaft(Shaft) (category Shaft, a TypeData::Shaft {} type created with the first shaft) is an outline from its level plus base_offset to top (a WallTop) or height, with an optional sketch. Floors, ceilings and roofs keep the shafts’ outlines in cuts (derived: EditCtx::finish → sync_shafts writes Project::shaft_cuts, only where they changed; shaft::fits requires the outline inside the slab and clear of its openings; repair drops bad ones). Readers chain them with the element’s own openings (Floor::all_openings, roof holes without the overhang shrink, ceilings’ holes); plans draw the shaft as an outline with two diagonals. cc_engine::commands::shaft holds shaft_create and shaft_type_create.cc_core::profile_sweep: ElementKind::Sweep(Sweep) (category Sweep) is a path in plan (open, or closed around a room) at base_offset above its level, with flip putting the profile on the right; its TypeData::Sweep { profile, material } type holds the profile (x across, to the left of the path; y up), checked by check_profile (closed, not crossing, bounded) and reset to baseboard() by repair. cc_core::sweep::sweep/sweep_closed miter it along the path, cc_geom::profile_sweep::sweep_faces places it, plans draw it with draw_mesh, legends its section, IFC export an IfcCovering MOLDING. A path may have arcs (#366): Sweep::bulges (serde default, skipped when empty; no format bump) holds the bulge of each segment (bulges[i] from point i to the next, the closing one’s kept unused while the path is open; missing ones straight), so a circle is a closed path of two points and two half circles; segments, length (arcs as arcs), stations (bounded by MAX_STATIONS), is_valid (two points close around an arc) and repair (before the element loop: at most one per point, numbers, MAX_BULGE); Element::transform negates them under a mirror. path_from_curves chains lines, arcs and one circle (PathProblem: unsupported curves, branches where the path would touch itself, curves apart, a retraced loop) into points and bulges, running the way the first curve runs. cc_geom::profile_sweep::sweep_mesh (faces and smooth flags) builds a curved path’s solid itself (curved_mesh): a section at every station, radial and unscaled on the arcs (segments(sweep, ARC_STEP)), mitered between true tangents at corners, sides split in triangles where not flat, the facets of the profile’s non-level edges on arcs (and of its own arcs when the type’s sketch is curved, section::smooth_sides) smooth; exact_volume (Pappus: area times the centroid’s path, arcs at the centroid’s radius, 2 c tan(θ/2) off at each mitered corner; none past MAX_MITER) goes into ModelGeometry::curved_volumes. Plans pass the smooth flags to mesh_piece; IFC export stays chorded. cc_engine::commands::sweep holds sweep_create (path points or curves, as floor_create takes them; a project without a sweep type gets a baseboard), sweep_type_create and sweep_profile_set (points or sketch curves).