ConstructCraft

cc_geom API

← API reference · Generated from the source by cargo run -p api_doc; edit the doc comments, not this page.

Derived geometry for ConstructCraft. ModelGeometry::build turns a cc_core::Project into boundary representation Solids (planar polygon faces) that feed the 3D renderer, elevations and sections, plus WallGeom and BeamGeom data used by plan views.

Modules

Module Items Summary
cc_geom 0 Derived geometry for ConstructCraft.
cc_geom::analytical 5 The analytical model: columns and beams as center lines (members) between shared points (nodes), for structural analysis programs.
cc_geom::bar_marks 9 Bar marks: the mark of every bar of every reinforcement set (see cc_core::bar_marks), resolved by a pure, deterministic function of the project and its bars.
cc_geom::bar_shape 3 The shape of a bar as a bending schedule describes it: open or closed, its legs in order with their lengths, the radii and turns of arc legs and the bends between legs, read from the bar’s center line.
cc_geom::beam 7 Structural framing joins: a beam end inside a structural column stops at the column’s face, and beam ends meet other beams the way walls do (a mitered L corner, a butt T against the side of a beam, a collinear pair running through a junction of three or more).
cc_geom::build 14  
cc_geom::component 6 Component pieces as solids: the definition’s pieces resolved with their parameter values, and the void pieces cut out of the solid pieces they overlap.
cc_geom::connection 17 Steel and timber connections (see cc_core::connection): the plates and bolts of each, derived from its member’s geometry on every build, so they follow the member.
cc_geom::coplanar 1 Coplanar faces of an imported mesh merged into polygons: the triangles a file splits a flat face into come back as one face, so views draw no diagonals across it and the piece holds fewer faces.
cc_geom::csg 3 Boolean operations on closed polygon meshes with binary space partitioning trees (the classic BSP-tree CSG algorithm: each solid’s polygons are clipped against the other’s tree).
cc_geom::curtain 6 Curtain walls in the world: the panels and mullions of a wall’s grid (see cc_core::curtain).
cc_geom::cut 2 Plane cuts used by sections and plan views.
cc_geom::faces 8 The faces of a column’s section, a given distance inside it: where its longitudinal bars stand and its stirrups run.
cc_geom::level_mark 2 The levels a level mark writes: measured from the floors under its point unless the mark sets them.
cc_geom::lightning 4 Lightning protection in the model: where an air terminal stands on a roof, and a simplified coverage check of the roofs by the air termination (air terminals and roof conductors).
cc_geom::mass 4 Conceptual masses: the body of a mass (an extrusion, or a loft between two outlines) and its mass floors, the sections at the levels it lists.
cc_geom::mep 12 Pipes, conduits and cable trays: each pipe or conduit segment is a cylinder of its type’s diameter along its center line, each cable tray an open channel (or a ladder) of its type’s section around it, colored by its system.
cc_geom::mep_net 7 The networks formed by pipes, conduits and cable trays: where runs meet (their ends within a centimeter, or an end on another run), the fittings there, the valves on pipes (each a node on its pipe’s run) and the fixtures and devices attached to the networks’ nodes.
cc_geom::mesh 5 Plan drawings of polyhedral meshes (component pieces imported from IFC): the edges seen from above and the section at the cut plane.
cc_geom::pad 10 Building pads (cc_core::pad) graded into their terrain’s surface.
cc_geom::paint 9 Painted faces on the built solids: finding the face a paint (cc_core::paint::FacePaint) refers to after a rebuild, and the surface it covers.
cc_geom::pile 7 Piles and pile caps (see cc_core::pile): their bodies, plans and exact quantities.
cc_geom::plan_cover 1 Hidden lines of plans.
cc_geom::polygon 15 2D polygon helpers.
cc_geom::profile_sweep 2 The solid of a swept profile: its type’s profile carried along its path in plan, at the level’s elevation plus its base offset, mitered at the corners (and around a closed path).
cc_geom::ramp 4 Ramp geometry: the sloped flights and flat landings of a ramp element laid out from its shape, its slab solids and the paths its railings follow.
cc_geom::rebar 9 Reinforcing bars: the center lines of each set of bars in its beam or column, from the host’s body, the cover and the bar diameters.
cc_geom::region 2 Regions covered by polygons: the union of simple polygons in a plane, optionally less what other polygons cover and kept within another polygon, as rings a painter can fill.
cc_geom::roof_framing 5 Roof framing: the purlins, rafters and battens under a roof’s sloped faces, from its type’s framing and covering (see cc_core::roofing).
cc_geom::roofs 10 Pitched roofs (gable and hip) over any footprint, courtyards included: every sloped eave raises a plane and every gable edge a vertical plane; the weighted straight skeleton (crate::skeleton) gives the part of each plane over the footprint, with its hips, valleys and ridges.
cc_geom::rooms 3 Room boundaries: the region enclosed by room-bounding walls around a point.
cc_geom::section 7 Cross-sections of columns and beams: type sections at each detail level, placed column bodies with smooth arc facets, and the legacy section shapes as rectangles and outlines (legends and IFC export).
cc_geom::sizing 9 Sizing of building services from their networks, with simplified tables of common Brazilian practice (from public sources):
cc_geom::skeleton 4 Weighted straight skeleton of a polygon with holes, for roofs.
cc_geom::slab_rebar 4 Slab reinforcement: the bars of floors and foundation slabs.
cc_geom::solid 8  
cc_geom::stair 15 Stair geometry: the treads, landings and winders of a stair element laid out from its shape, the solids of its construction (solid, cast in place, assembled) and the paths its railings follow.
cc_geom::strip 1 Arc strip footings: the body of a strip (a ground beam) that follows an arc, a band between concentric arcs either side of its centerline, its ends cut where it meets other strips.
cc_geom::strip_rebar 2 Strip footing reinforcement: bars across the footing slab (radial in an arc strip), bars along it (ring bars), and the bars of a beam for the beam on top of a haunched strip (or the whole section of a plain one).
cc_geom::topography 11 Terrain surfaces (cc_core::topography): a constrained Delaunay triangulation (spade) of the measured points inside the boundary, with the boundary’s edges as constraints, so non-convex boundaries keep no triangle outside.
cc_geom::wall 12  
cc_geom::wall_rebar 4 Wall reinforcement: horizontal bars (ring bars in an arc wall) and vertical bars near each face of a wall’s structure, and ties between the faces.

cc_geom

crates/cc_geom/src/lib.rs

Re-exports

cc_geom::analytical

crates/cc_geom/src/analytical.rs

The analytical model: columns and beams as center lines (members) between shared points (nodes), for structural analysis programs. A beam framed into a column, or running on over one it passes, ends on the column’s axis, a beam ending on another beam ends on that beam’s line, a column standing on or under a beam (a truss’s vertical between its chords) ends on the beam’s line, and a member is split wherever another member ends on it, so connected members share their nodes.

Items: MemberKind · Node · Member · AnalyticalModel · analytical_model

enum MemberKind

pub enum MemberKind

Traits: Debug, Clone, Copy, PartialEq, Eq

Variants

struct Node

pub struct Node

Traits: Debug, Clone, PartialEq

Fields

struct Member

pub struct Member

A straight member between two nodes; an element split by connections gives several members.

Traits: Debug, Clone, PartialEq

Fields

struct AnalyticalModel

pub struct AnalyticalModel

Traits: Debug, Clone, Default, PartialEq

Fields

Methods

fn analytical_model

pub fn analytical_model(project: &Project, geom: &ModelGeometry) -> AnalyticalModel

Build the analytical model of the structural columns and the beams.

cc_geom::bar_marks

crates/cc_geom/src/bar_marks.rs

Bar marks: the mark of every bar of every reinforcement set (see cc_core::bar_marks), resolved by a pure, deterministic function of the project and its bars. A mark names one shape: the same diameter, steel grade and ShapeSummary within the project’s length tolerance and ANGLE_TOLERANCE_DEG (read from either end, mirrored, a closed bar from any corner). In order:

  1. a set with a bar_mark override gives all its bars that mark (bars of different shapes make one Mark each, of the same text);
  2. a bar whose shape matches an entry of the frozen marks table takes the first such entry’s mark;
  3. the shapes left are numbered with the prefix after the highest frozen number (from start, skipping marks already used), in the stable order partition, diameter descending, length descending, shape; a bar joins the first numbered shape it matches. The marks come sorted naturally (N2 before N10), each with its count, total length (the exact sum of its bars) and weight.

Items: MarkSource · Mark · BarMarks · resolve · natural · canonical · to_mark_shape · from_mark_shape · resolve_with

enum MarkSource

pub enum MarkSource

Where a mark comes from.

Traits: Debug, Clone, Copy, PartialEq, Eq, Hash

Variants

struct Mark

pub struct Mark

One mark: a text naming bars of one diameter, grade and shape.

Traits: Debug, Clone, PartialEq

Fields

Methods

struct BarMarks

pub struct BarMarks

The marks of a project’s bars.

Traits: Debug, Clone, PartialEq, Default

Fields

Methods

fn resolve

pub fn resolve(project: &Project, rebar: &BTreeMap<ElementId, RebarGeom>) -> BarMarks

The marks of rebar (the model’s bars, ModelGeometry::rebar) with the project’s marking and the sets’ overrides.

fn natural

pub fn natural(a: &str, b: &str) -> Ordering

Natural order of marks: runs of digits compare as numbers (N2 before N10).

fn canonical

pub fn canonical(s: &ShapeSummary) -> ShapeSummary

The canonical reading of a shape: of the readings from either end, mirrored and (closed bars of up to 64 legs) from any corner, the one with the least key. Shapes that match read the same, up to the tolerance.

fn to_mark_shape

pub fn to_mark_shape(s: &ShapeSummary) -> Option<MarkShape>

A shape as the frozen marks table keeps it (turns in degrees); none for shapes of more than MAX_MARK_LEGS legs or that are not usable.

fn from_mark_shape

pub fn from_mark_shape(m: &MarkShape) -> ShapeSummary

The summary of a frozen shape.

fn resolve_with

pub fn resolve_with(project: &Project, rebar: &BTreeMap<ElementId, RebarGeom>, marking: &BarMarking, overrides: bool) -> BarMarks

resolve with marking instead of the project’s, and the sets’ overrides left out unless overrides.

cc_geom::bar_shape

crates/cc_geom/src/bar_shape.rs

The shape of a bar as a bending schedule describes it: open or closed, its legs in order with their lengths, the radii and turns of arc legs and the bends between legs, read from the bar’s center line. Independent of where the bar lies, so bars of one shape compare equal wherever they are (ShapeSummary::matches).

Items: LegSummary · ShapeSummary · summary

struct LegSummary

pub struct LegSummary

One leg of a ShapeSummary.

Traits: Debug, Clone, Copy, PartialEq

Fields

struct ShapeSummary

pub struct ShapeSummary

The shape of a bar: see the module.

Traits: Debug, Clone, PartialEq, Default

Fields

Methods

fn summary

pub fn summary(bar: &Bar) -> ShapeSummary

The shape of bar, read from its center line. Points in a line make one straight leg; equal chords turning evenly by a small angle make one arc leg, with the radius and the length of the arc through their points. A bar whose true length differs from its center line’s (the hooks of a tie, counted but not drawn) has the difference spread over its legs.

cc_geom::beam

crates/cc_geom/src/beam.rs

Structural framing joins: a beam end inside a structural column stops at the column’s face, and beam ends meet other beams the way walls do (a mitered L corner, a butt T against the side of a beam, a collinear pair running through a junction of three or more).

Items: BeamEnd · BeamGeom · box_section · beam_section · BeamInput · ColumnInput · resolve_beams

enum BeamEnd

pub enum BeamEnd

What a beam end is framed into.

Traits: Debug, Clone, Copy, PartialEq, Eq

Variants

struct BeamGeom

pub struct BeamGeom

Resolved beam geometry: frame, section and the ends after joins.

Traits: Debug, Clone, PartialEq

Fields

Methods

fn box_section

pub(crate) fn box_section(width: f64, height: f64) -> SectionOutline

A width x height box section: centered across, up from 0.

fn beam_section

pub(crate) fn beam_section(section: &SectionOutline) -> (SectionOutline, f64)

A type’s section as a beam sweeps it: centered across on its box, its bottom at 0 (x across, y up). Returns the section and its half width.

struct BeamInput

pub(crate) struct BeamInput

A beam as seen by the join resolution.

Traits: Debug, Clone

Fields

struct ColumnInput

pub(crate) struct ColumnInput

A structural column as seen by the join resolution.

Traits: Debug, Clone

Fields

fn resolve_beams

pub(crate) fn resolve_beams(beams: &[BeamInput], columns: &[ColumnInput]) -> Vec<BeamGeom>

Resolve the joins of every beam: column faces first, then beam to beam among beams whose depths overlap.

cc_geom::build

crates/cc_geom/src/build.rs

Items: FRAME_COLOR · HostedPart · opening_parts · hosted_parts · OpeningSymbol · ModelGeometry · SolidIndex · FoundationGeom · BoxPart · column_outline · rect_outline · component_parts · WorldConnector · component_connectors

const FRAME_COLOR

pub const FRAME_COLOR: [u8; 3]

Shading color of door and window frames.

struct HostedPart

pub struct HostedPart

One box of a door or window, in opening-local coordinates: x along the wall from the start jamb, y across the wall (positive on its left), z up from the sill.

Traits: Debug, Clone, Copy, PartialEq

Fields

fn opening_parts

pub fn opening_parts(project: &Project, element: &cc_core::Element, width: f64, height: f64, half: f64) -> Vec<cc_core::component::ComponentPart>

The pieces of the door or window element (of width x height, in a wall of half thickness half) in opening-local coordinates like HostedParts: x along the wall from the start jamb, y across it (positive on its left), z up from the sill. A door or window component is resolved with the wall’s thickness, centered in the opening and mirrored by the element’s flips; other types give their boxes, frames with no material and panels of the type’s material.

fn hosted_parts

pub fn hosted_parts(data: &TypeData, width: f64, height: f64, half: f64) -> Vec<HostedPart>

The boxes making up a door or window of width x height in a wall of half thickness half. Empty for non-hosted types.

struct OpeningSymbol

pub struct OpeningSymbol

A window’s elevation symbol on one face of its wall (see cc_core::WindowOperation::elevation_lines): the opening’s outline just off the face, facing out along normal, and the symbol’s lines on it, drawn by elevations and sections where nothing stands in front.

Traits: Debug, Clone, PartialEq

Fields

struct ModelGeometry

pub struct ModelGeometry

All derived geometry of a project.

Traits: Debug, Clone, Default

Fields

Methods

struct SolidIndex

pub struct SolidIndex

The positions of each element’s solids in ModelGeometry::solids, in order, so that finding an element’s solids does not scan them all. It is used only while solids has the length it was made for; geometry put together by hand (or changed after the build) is scanned instead.

Traits: Debug, Clone, Default

Some fields are private.

struct FoundationGeom

pub struct FoundationGeom

A foundation’s body: a vertical prism.

Traits: Debug, Clone, PartialEq

Fields

Methods

struct BoxPart

pub struct BoxPart

An axis-aligned box in a horizontal frame: origin, plan axes u/v (unit, perpendicular) and extents along them and in absolute Z.

Traits: Debug, Clone, Copy, PartialEq

Fields

Methods

fn column_outline

pub fn column_outline(project: &Project, data: &TypeData, position: DVec2, rotation_deg: f64) -> Vec<DVec2>

Plan outline of a column type’s section (counter-clockwise), placed at position and turned by rotation_deg: the outer boundary of its profile. Empty for other types or a section that fails.

fn rect_outline

pub fn rect_outline(width: f64, depth: f64, position: DVec2, rotation_deg: f64) -> Vec<DVec2>

A width x depth rectangle (counter-clockwise) centered at position, turned by rotation_deg: the footprint of a pad footing.

fn component_parts

pub fn component_parts(project: &Project, element: &cc_core::Element, component: &cc_core::Component) -> Vec<cc_core::component::ComponentPart>

Solid pieces of a placed component in world coordinates (voids cut out): footprints rotated and moved to the insertion point, elevations absolute. Pieces whose expressions fail are left out (the component editor reports them). ModelGeometry::components holds them for every component of the model.

struct WorldConnector

pub struct WorldConnector

A component’s connector in the world: where a run joins it (point, its z the absolute elevation) and the way the run leaves (direction).

Traits: Debug, Clone, PartialEq

Fields

fn component_connectors

pub fn component_connectors(project: &Project, element: &cc_core::Element) -> Vec<WorldConnector>

The connectors of a placed component, in the world.

cc_geom::component

crates/cc_geom/src/component.rs

Component pieces as solids: the definition’s pieces resolved with their parameter values, and the void pieces cut out of the solid pieces they overlap. Script pieces run through the process’s shared script cache (cc_script::shared).

Items: resolve_component · resolve_component_in · resolve_pieces · resolve_instance · instance_errors · faces_of

fn resolve_component

pub fn resolve_component(def: &ComponentDef, overrides: &BTreeMap<String, f64>) -> Vec<ComponentPart>

The solid pieces of def with overrides, in the component’s frame, voids cut out. A piece a void reaches becomes faces; past the boolean budget it stays whole. Pieces whose expressions fail are left out.

fn resolve_component_in

pub fn resolve_component_in(def: &ComponentDef, overrides: &BTreeMap<String, f64>, extra: &[(&str, f64)]) -> Vec<ComponentPart>

resolve_component with extra names defined (a door’s wall thickness).

fn resolve_pieces

pub fn resolve_pieces(def: &ComponentDef, overrides: &BTreeMap<String, f64>, extra: &[(&str, f64)]) -> (Vec<ComponentPart>, Vec<(usize, PartError)>)

Every piece of def and the errors of those that fail (script pieces run), without cutting voids: for editors and checks.

fn resolve_instance

pub fn resolve_instance(ty: &ElementType, def: &ComponentDef, element: &cc_core::Element, component: Option<&cc_core::Component>, extra: &[(&str, f64)]) -> Vec<ComponentPart>

The solid pieces of a placed component of type ty (its instance values, text values and moved hotspots), voids cut out. A failing script shows the last pieces that worked for this element.

fn instance_errors

pub fn instance_errors(ty: &ElementType, def: &ComponentDef, element: &cc_core::Element, component: Option<&cc_core::Component>) -> Vec<(usize, PartError)>

The errors of a placed component’s pieces (a failing script’s among them).

fn faces_of

pub fn faces_of(part: &ComponentPart) -> Vec<Vec<DVec3>>

The closed faces of a piece (a prism’s are built from its footprint).

cc_geom::connection

crates/cc_geom/src/connection.rs

Steel and timber connections (see cc_core::connection): the plates and bolts of each, derived from its member’s geometry on every build, so they follow the member. Plates are oriented boxes (Block), bolts and washers cylinders (Rod). A connection whose member is missing, or whose member end is not framed as its kind needs, builds nothing and carries a ConnectionWarning.

Items: BOLT_EXTRA · WASHER_RATIO · FIN_HEIGHT · HANGER_SIDE · STEEL_COLOR · Block · Rod · Bolt · Plate · ConnectionWarning · ConnectionGeom · beam_end_join · suits · steel_material · solid · connection_geom · build_connections

const BOLT_EXTRA

pub const BOLT_EXTRA: f64

End and fin plate bolts are the plate’s thickness plus this (nut and head), meters.

const WASHER_RATIO

pub const WASHER_RATIO: f64

Washer diameter per bolt diameter.

const FIN_HEIGHT

pub const FIN_HEIGHT: f64

A fin plate’s height per section height.

const HANGER_SIDE

pub const HANGER_SIDE: f64

A hanger’s sides per beam height.

const STEEL_COLOR

pub const STEEL_COLOR: [u8; 3]

Connections drawn without a metal material in the project.

struct Block

pub struct Block

A box: its center, two square unit axes x and y (the third is x × y) and its size along the three.

Traits: Debug, Clone, Copy, PartialEq

Fields

Methods

struct Rod

pub struct Rod

A cylinder from a to b.

Traits: Debug, Clone, Copy, PartialEq

Fields

Methods

struct Bolt

pub struct Bolt

A bolt (or anchor bolt) and its washers.

Traits: Debug, Clone, PartialEq

Fields

struct Plate

pub struct Plate

A plate: one box, or several for a bent plate (a hanger’s base and sides).

Traits: Debug, Clone, PartialEq

Fields

Methods

enum ConnectionWarning

pub enum ConnectionWarning

Why a connection built nothing.

Traits: Debug, Clone, Copy, PartialEq, Eq

Variants

Methods

struct ConnectionGeom

pub struct ConnectionGeom

The parts of one connection.

Traits: Debug, Clone, PartialEq

Fields

Methods

fn beam_end_join

pub fn beam_end_join(g: &BeamGeom, end: MemberEnd) -> Option<BeamEnd>

How the end end of a beam is framed (None for a column’s base).

fn suits

pub fn suits(kind: ConnectionKind, joined: BeamEnd) -> bool

Whether a beam end framed as joined takes a connection of kind.

fn steel_material

pub fn steel_material(project: &Project) -> Option<&str>

The material connections are drawn in: the project’s first metal.

fn solid

pub fn solid(project: &Project, element: ElementId) -> Solid

An empty solid of connection element, in steel.

fn connection_geom

pub fn connection_geom(project: &Project, beams: &BTreeMap<ElementId, BeamGeom>, id: ElementId, c: &Connection) -> ConnectionGeom

Connection id as c and its member make it.

fn build_connections

pub fn build_connections(project: &Project, beams: &BTreeMap<ElementId, BeamGeom>) -> BTreeMap<ElementId, ConnectionGeom>

Every connection of the project, from the resolved beams.

cc_geom::coplanar

crates/cc_geom/src/coplanar.rs

Coplanar faces of an imported mesh merged into polygons: the triangles a file splits a flat face into come back as one face, so views draw no diagonals across it and the piece holds fewer faces. Faces grow one neighbor at a time across shared edges (opposite directions, so the winding agrees), keeping each merged face a simple polygon: a neighbor joins only when it shares one run of edges with the face so far and touches it nowhere else, so no hole or pinch can form. A ring of triangles thus stays two faces or more. Vertices are never dropped (a point on a straight run may be a corner of a neighbor).

Items: merge

fn merge

pub fn merge(vertices: &[[f64; 3]], faces: Vec<Vec<u32>>) -> Vec<Vec<u32>>

faces (indices into vertices) with neighbors in one plane merged.

cc_geom::csg

crates/cc_geom/src/csg.rs

Boolean operations on closed polygon meshes with binary space partitioning trees (the classic BSP-tree CSG algorithm: each solid’s polygons are clipped against the other’s tree). Trees live in arenas and are walked with explicit stacks, so deep trees cannot overflow the call stack; operations whose fragments would exceed a budget give up and return None, leaving the caller with the uncut solid.

Items: subtract · intersect · bounds_overlap

fn subtract

pub fn subtract(a: &[Vec<DVec3>], b: &[Vec<DVec3>]) -> Option<Vec<Vec<DVec3>>>

a minus b (both closed and outward), or None past the budget.

fn intersect

pub fn intersect(a: &[Vec<DVec3>], b: &[Vec<DVec3>]) -> Option<Vec<Vec<DVec3>>>

The common part of a and b, or None past the budget.

fn bounds_overlap

pub fn bounds_overlap(a: &[Vec<DVec3>], b: &[Vec<DVec3>]) -> bool

Whether the bounding boxes of two meshes overlap.

cc_geom::curtain

crates/cc_geom/src/curtain.rs

Curtain walls in the world: the panels and mullions of a wall’s grid (see cc_core::curtain). Panels are flat: in an arc wall each one spans the chord between its grid lines, and mullions stand square to the arc on its lines.

Items: PanelGeom · MullionGeom · CurtainGeom · build · solids · volume

struct PanelGeom

pub struct PanelGeom

A panel placed in the world.

Traits: Debug, Clone, PartialEq

Fields

Methods

struct MullionGeom

pub struct MullionGeom

A mullion piece placed in the world: a vertical prism over footprint.

Traits: Debug, Clone, PartialEq

Fields

struct CurtainGeom

pub struct CurtainGeom

The panels and mullions of a curtain wall.

Traits: Debug, Clone, PartialEq, Default

Fields

Methods

fn build

pub fn build(project: &Project, element: &Element, g: &WallGeom, system: &curtain::CurtainSystem) -> CurtainGeom

Lay out the curtain grid of wall element (type system) over its geometry g: between its ends after joins, from its base to its top.

fn solids

pub fn solids(project: &Project, element: &Element, c: &CurtainGeom) -> Vec<Solid>

The solids of a curtain wall: one per material of its panels and mullions.

fn volume

pub fn volume(c: &CurtainGeom) -> f64

Volume of the glass and solid panels and of the mullions.

cc_geom::cut

crates/cc_geom/src/cut.rs

Plane cuts used by sections and plan views.

Items: face_plane_segments · clip_polygon

fn face_plane_segments

pub fn face_plane_segments(face: &Face, point: DVec3, normal: DVec3) -> Vec<(DVec3, DVec3)>

Segments where face crosses the plane through point with normal.

fn clip_polygon

pub fn clip_polygon(verts: &[DVec3], point: DVec3, normal: DVec3) -> Vec<DVec3>

Sutherland–Hodgman clip keeping the part with (p - point)·normal >= 0.

cc_geom::faces

crates/cc_geom/src/faces.rs

The faces of a column’s section, a given distance inside it: where its longitudinal bars stand and its stirrups run. A face is a straight side, a run of the chords of a curve, or (for an annular sector) a true arc; faces meet at corners, in counter-clockwise order.

Items: SectionFace · sector_faces · outline_faces · FaceBar · face_bars · rectangles · face_loop · across

struct SectionFace

pub struct SectionFace

One face of a section.

Traits: Debug, Clone, PartialEq

Fields

Methods

fn sector_faces

pub fn sector_faces(s: &SectorPlacement, inset: f64) -> Vec<SectionFace>

The faces of an annular sector inset inside it, exact: the outer arc, the left radial side, the inner arc and the right radial side (a circular sector, or one whose radial sides meet before the inner arc, has no inner arc: its radial sides meet at a point). Empty when nothing is left inside the inset.

fn outline_faces

pub fn outline_faces(outline: &[DVec2], inset: f64) -> Vec<SectionFace>

The faces of a section’s outline moved inset inside it: its corners are where it turns sharply, or where the lengths of its sides jump (a straight side beside the chords of a fillet); the sides between two corners are one face. A circle is one closed face. Empty when the outline does not survive the inset.

struct FaceBar

pub struct FaceBar

A longitudinal bar in the section: where it stands, the normal into the section there, and whether it stands at a corner.

Traits: Debug, Clone, Copy, PartialEq

Fields

fn face_bars

pub fn face_bars(faces: &[SectionFace], spec: &[FaceBars], count: usize) -> Vec<FaceBar>

The bars on faces: one at every corner, and between the corners of each face what its entry of spec says; without a spec, count bars, the corners first and each of the others on the face with the widest gap. A closed face (a circle) takes its bars evenly around.

fn rectangles

pub fn rectangles(outline: &[DVec2]) -> Vec<(DVec2, DVec2)>

The closed loop around faces (a stirrup’s center line) and its true length, arcs as arcs. The largest rectangles (min, max) inside an outline whose sides all run along its own X or Y axis: two in an L or a T, three in a U, one in a rectangle. Together they cover it, overlapping where its parts meet. Empty for any other outline, or one with too many corners.

fn face_loop

pub fn face_loop(faces: &[SectionFace]) -> (Vec<DVec2>, f64)

fn across

pub fn across(faces: &[SectionFace], from: DVec2, inward: DVec2, clear: f64) -> Option<DVec2>

Where a cross-tie from from (on a face whose normal into the section is inward) meets the face opposite, at least clear away: straight across, or square to the bisector of that face and a straight face that leans towards it (the radial sides of a sector); whichever leaves and arrives nearest to square, and within 45° of both faces’ normals.

cc_geom::level_mark

crates/cc_geom/src/level_mark.rs

The levels a level mark writes: measured from the floors under its point unless the mark sets them. In a plan the finished level is the top of the highest floor of the plan’s level under the point (the level itself where there is none); in elevations and sections it is the height of the point. The raw level is the top of that floor’s structure (below its finish layers): in sections from the floor whose top the point lies on, on the cut line.

Items: MarkLevels · levels

struct MarkLevels

pub struct MarkLevels

Levels to write, as elevations of the project (the type’s datum not added).

Traits: Debug, Clone, Copy, PartialEq

Fields

fn levels

pub fn levels(project: &Project, view: &View, mark: &LevelMark) -> Option<MarkLevels>

The levels mark writes in view (none in views without levels: 3D, legends, diagrams…).

cc_geom::lightning

crates/cc_geom/src/lightning.rs

Lightning protection in the model: where an air terminal stands on a roof, and a simplified coverage check of the roofs by the air termination (air terminals and roof conductors). The check samples the exposed upward faces of roofs (and of floors above the lowest level that nothing covers) and asks, for each point, whether one air termination point protects it by itself: the point lies inside the protected volume of a single rod under the rolling sphere method, over a horizontal reference plane at the lowest point of the element’s exposed faces (its eaves). On flat parts (slope up to 1:10) a point within half the class’s mesh width of a roof conductor is protected as by the mesh method. Mutual protection between terminals (the sphere sagging between two rods) and the shielding by the building are left out, which errs on the safe side.

Items: surface_top · air_points · Coverage · check

fn surface_top

pub fn surface_top(geom: &ModelGeometry, p: DVec2) -> Option<f64>

The world height of the highest roof or floor surface over plan point p (None where there is none).

fn air_points

pub fn air_points(project: &Project, geom: &ModelGeometry) -> Vec<(ElementId, DVec3)>

The points of the air termination: the tip of each air terminal (the top of its solids) and points along each roof (air) conductor, at most step meters apart.

struct Coverage

pub struct Coverage

The result of a coverage check.

Traits: Debug, Clone, PartialEq

Fields

Methods

fn check

pub fn check(project: &Project, geom: &ModelGeometry, class: LpsClass, spacing: f64) -> Coverage

Check how the air termination covers the roofs for class, sampling the roofs about spacing meters apart (more when they are large).

cc_geom::mass

crates/cc_geom/src/mass.rs

Conceptual masses: the body of a mass (an extrusion, or a loft between two outlines) and its mass floors, the sections at the levels it lists.

Items: MassGeom · mass_geom · face_at · face_outline

struct MassGeom

pub struct MassGeom

A mass’s body and floors.

Traits: Debug, Clone, PartialEq

Fields

Methods

fn mass_geom

pub fn mass_geom(project: &Project, e: &Element, m: &Mass) -> Option<MassGeom>

The body and floors of mass m (element e), or None when it is degenerate.

fn face_at

pub fn face_at(m: &Mass, g: &MassGeom, p: DVec3) -> Option<cc_core::mass::MassFace>

The face of mass m (built as g) at p, a point on its body: the top or bottom, or the side over the nearest edge of an extrusion’s outline (a loft’s sides are not pushed).

fn face_outline

pub fn face_outline(m: &Mass, g: &MassGeom, face: cc_core::mass::MassFace) -> Option<(Vec<DVec3>, DVec3)>

The outline of a face of m in the world, and its outward normal.

cc_geom::mep

crates/cc_geom/src/mep.rs

Pipes, conduits and cable trays: each pipe or conduit segment is a cylinder of its type’s diameter along its center line, each cable tray an open channel (or a ladder) of its type’s section around it, colored by its system. Valves sit on their pipes as a body, a stem and a handwheel or lever.

Items: TraySection · SegmentGeom · ValveGeom · segment_geom · valve_geom · frustum · cylinder · section_frame · tray_sheet · tray_profile · tray · valve

struct TraySection

pub struct TraySection

The section of a cable tray run.

Traits: Debug, Clone, Copy, PartialEq

Fields

struct SegmentGeom

pub struct SegmentGeom

A pipe, conduit or cable tray run in the world.

Traits: Debug, Clone, Copy, PartialEq

Fields

Methods

struct ValveGeom

pub struct ValveGeom

A valve in the world.

Traits: Debug, Clone, Copy, PartialEq

Fields

fn segment_geom

pub fn segment_geom(project: &Project, e: &Element) -> Option<SegmentGeom>

The run of a pipe, conduit or cable tray element (None for other elements or a degenerate run).

fn valve_geom

pub fn valve_geom(project: &Project, e: &Element) -> Option<ValveGeom>

The valve element e placed on its pipe (None for other elements, or when its pipe has no run).

fn frustum

pub fn frustum(a: DVec3, b: DVec3, ra: f64, rb: f64) -> Vec<Vec<DVec3>>

The faces of a closed frustum from a (radius ra) to b (radius rb).

fn cylinder

pub fn cylinder(a: DVec3, b: DVec3, radius: f64) -> Vec<Vec<DVec3>>

The faces of a closed cylinder of radius from a to b.

fn section_frame

pub fn section_frame(axis: DVec3) -> (DVec3, DVec3)

A frame across axis: side to the left of a horizontal run and up above it (side × up = axis); vertical runs take the X axis as side.

fn tray_sheet

pub fn tray_sheet(height: f64) -> f64

Thickness of a tray’s sheet for a section height tall.

fn tray_profile

pub fn tray_profile(t: TraySection) -> Vec<glam::DVec2>

The section of a tray as an open channel, counter-clockwise in (side, up) coordinates of section_frame around its center line.

fn tray

pub fn tray(a: DVec3, b: DVec3, t: TraySection) -> Vec<Vec<DVec3>>

The faces of a cable tray of section t from a to b (center line in the middle of the section): two side rails and a bottom, or rungs for a ladder.

fn valve

pub fn valve(v: &ValveGeom) -> Vec<Vec<DVec3>>

The faces of a valve: a body narrowing to its middle along the pipe and, except for check valves, a stem with a handwheel (or a lever on ball valves).

cc_geom::mep_net

crates/cc_geom/src/mep_net.rs

The networks formed by pipes, conduits and cable trays: where runs meet (their ends within a centimeter, or an end on another run), the fittings there, the valves on pipes (each a node on its pipe’s run) and the fixtures and devices attached to the networks’ nodes. Pipes connect only to pipes of the same system; conduits connect to any conduit (they meet in boxes), cable trays to any cable tray. Fittings are derived like wall joins: an elbow where two runs turn, a coupling (or a reducer, between diameters or tray widths) where they continue straight, a tee where three branches meet and a cross from four.

Items: TOL · ATTACH · FittingKind · Fitting · NetNode · NetEdge · MepNetwork

const TOL

pub const TOL: f64

Ends closer than this meet (1 cm).

const ATTACH

pub const ATTACH: f64

A fixture or device is attached to a node within this distance in plan.

enum FittingKind

pub enum FittingKind

What a fitting is.

Traits: Debug, Clone, Copy, PartialEq

Variants

Methods

struct Fitting

pub struct Fitting

A fitting at a node.

Traits: Debug, Clone, PartialEq

Fields

Methods

struct NetNode

pub struct NetNode

A point where runs end or meet.

Traits: Debug, Clone, PartialEq

Fields

struct NetEdge

pub struct NetEdge

A piece of a run between two consecutive nodes along it.

Traits: Debug, Clone, Copy, PartialEq

Fields

struct MepNetwork

pub struct MepNetwork

The pipe, conduit and cable tray networks of a project.

Traits: Debug, Clone, Default, PartialEq

Fields

Methods

cc_geom::mesh

crates/cc_geom/src/mesh.rs

Plan drawings of polyhedral meshes (component pieces imported from IFC): the edges seen from above and the section at the cut plane.

Items: UP · MeshPlan · plan_edges · top_edges · mesh_plan

const UP

pub(crate) const UP: f64

Faces with a normal Z component above this face upwards.

struct MeshPlan

pub struct MeshPlan

What a mesh shows in a plan cut at cut_z.

Traits: Debug, Clone, Default, PartialEq

Fields

fn plan_edges

pub fn plan_edges(faces: &[Vec<DVec3>]) -> Vec<(DVec3, DVec3)>

Edges of faces that read in a view from above: outlines of upward faces where they meet faces turned away, open boundaries and sharp creases (shared edges of smooth or flat regions are left out).

fn top_edges

pub fn top_edges(faces: &[Vec<DVec3>], smooth: &[bool]) -> Vec<(DVec3, DVec3)>

Edges of the closed piece faces seen from above, as views draw a solid: the outlines of its faces turned up where they meet a face in another plane, and between the facets of a curved surface only the silhouette, where a facet turned up meets one turned away (the edges between facets that both face up are never drawn, nor the pieces of facets a boolean split). smooth flags the facets of curved surfaces, one per face (see crate::Solid::smooth_curved); with any other length they are found here. Each edge comes once, in a stable order.

fn mesh_plan

pub fn mesh_plan(faces: &[Vec<DVec3>], smooth: &[bool], cut_z: f64) -> MeshPlan

Plan of a mesh cut at cut_z, its edges as top_edges finds them (smooth: its curved surfaces’ facets, or empty).

cc_geom::pad

crates/cc_geom/src/pad.rs

Building pads (cc_core::pad) graded into their terrain’s surface. For a pad at absolute elevation z_p, with d the plan distance from its outline (0 inside), the graded surface is F = max(L, min(T, C)), where T is the surface before the pad, C = z_p + d / cut the cut slope and L = z_p - d / fill the fill slope. Pads apply one after another. Only the surface’s triangles near the pad (within the farthest distance a slope can reach) are rebuilt: a constrained Delaunay triangulation of their vertices, with their edges as constraints (split where the new ones cross them), plus samples along rays out of the outline, the daylight points where the slopes meet the ground (found by bisection) and the outline and daylight lines as constraints. Every new triangle lies inside one old triangle, so the old surface is linear on it, and its vertices take F: cut and fill volumes are integrated exactly between the two.

Items: MAX_RINGS · MAX_PAD_VERTICES · PadWarning · SlopeRay · PadGeom · Surface · PadInput · grade · pad_at · mesh_boundary

const MAX_RINGS

pub const MAX_RINGS: usize

Most offset rings (sample distances along each ray, doubling from FIRST_RING).

const MAX_PAD_VERTICES

pub const MAX_PAD_VERTICES: usize

Most vertices a pad adds to the surface: past it, the slopes are sampled more coarsely.

enum PadWarning

pub enum PadWarning

Something about a pad the user should know (shown with the element).

Traits: Debug, Clone, Copy, PartialEq, Eq

Variants

Methods

struct SlopeRay

pub struct SlopeRay

A slope sample: from a point of the outline out to where its slope meets the ground (or the terrain’s edge).

Traits: Debug, Clone, Copy, PartialEq

Fields

struct PadGeom

pub struct PadGeom

A graded pad.

Traits: Debug, Clone, PartialEq, Default

Fields

struct Surface

pub struct Surface

A surface being graded: triangles (absolute z, counter-clockwise from above) and the elevation the original ground had at each of their vertices.

Traits: Debug, Clone, Default

Fields

Methods

struct PadInput

pub struct PadInput<'a>

What a pad grades: its outline, absolute elevation and slope ratios.

Traits: Debug, Clone

Fields

fn grade

pub fn grade(surface: &mut Surface, pad: &PadInput) -> PadGeom

Grade pad into surface. A failure leaves the surface as it was, with a warning.

fn pad_at

pub fn pad_at(project: &cc_core::Project, terrain: cc_core::ElementId, p: DVec2) -> Option<cc_core::ElementId>

The pad of terrain terrain whose outline holds plan point p (the last applied wins), so a click on the graded earth picks the pad there.

fn mesh_boundary

pub fn mesh_boundary(triangles: &[[DVec3; 3]]) -> Option<Vec<DVec3>>

The boundary of triangles (their unshared edges) as one loop, counter-clockwise, or None when they do not make exactly one.

cc_geom::paint

crates/cc_geom/src/paint.rs

Painted faces on the built solids: finding the face a paint (cc_core::paint::FacePaint) refers to after a rebuild, and the surface it covers. The rule: among the faces of the element’s body (framing and other secondary parts left out) whose normal is within cc_core::paint::NORMAL_TOLERANCE_DEG of the paint’s, the one that passes nearest the paint’s point; then, from it, the faces that touch it in the same plane (a wall face split around its openings) and, on a curved surface, the smooth facets that join it, face after face.

Items: FaceRef · distance_to_face · nearest_face · surface · resolve · body_solids · face_hit · apply · painted_area

type alias FaceRef

pub type FaceRef = (usize, usize)

A face of one of an element’s solids: the solid’s index in the list searched, and the face’s index in it.

fn distance_to_face

pub fn distance_to_face(face: &Face, p: DVec3) -> f64

Distance from p to the polygon of face.

fn nearest_face

pub fn nearest_face(solids: &[&Solid], point: DVec3, normal: Option<DVec3>) -> Option<(FaceRef, f64)>

The face of solids nearest point (with a normal within the tolerance of normal, when given), and its distance.

fn surface

pub fn surface(solids: &[&Solid], start: FaceRef) -> Vec<FaceRef>

The surface of face start: it and, face after face, those touching it in its plane or (from a smooth facet) the smooth facets joining it.

fn resolve

pub fn resolve(solids: &[&Solid], paint: &FacePaint) -> Vec<FaceRef>

The faces paint covers among solids (none when no face is turned like it).

fn body_solids

pub fn body_solids(geom: &ModelGeometry, id: ElementId) -> Vec<&Solid>

The faces of an element’s body: its solids that are not secondary parts.

fn face_hit

pub fn face_hit(geom: &ModelGeometry, id: ElementId, ray: crate::Ray) -> Option<(DVec3, DVec3)>

Where ray meets the body of element id: the point and the normal of the face it meets first.

fn apply

pub(crate) fn apply(project: &Project, solids: &mut [Solid])

Paint the solids of every element with paints (a later paint wins where two cover the same face).

fn painted_area

pub fn painted_area(solids: &[&Solid]) -> BTreeMap<String, f64>

Area painted with each material, square meters (the faces each paint covers).

cc_geom::pile

crates/cc_geom/src/pile.rs

Piles and pile caps (see cc_core::pile): their bodies, plans and exact quantities. A round pile is a cylinder of smooth facets, a square one a prism; a cap is a prism of its outline, a round cap a cylinder and a ring cap an annulus, their curved faces smooth. Volumes and areas are exact (circles as circles, not chords).

Items: circle_segments · PileGeom · pile_geom · CapGeom · cap_geom · add_cylinder · add_ring

fn circle_segments

pub fn circle_segments() -> usize

Number of chords of a full circle.

struct PileGeom

pub struct PileGeom

A pile in the world.

Traits: Debug, Clone, PartialEq

Fields

Methods

fn pile_geom

pub fn pile_geom(project: &Project, e: &cc_core::Element, p: &cc_core::pile::Pile) -> Option<PileGeom>

The pile e in the world (None when its type is no pile type or it has no length).

struct CapGeom

pub struct CapGeom

A pile cap’s frame and plan, for its geometry and reinforcement.

Traits: Debug, Clone, PartialEq

Fields

Methods

fn cap_geom

pub fn cap_geom(project: &Project, e: &cc_core::Element) -> Option<CapGeom>

The cap e in the world (None when it is no pile cap).

fn add_cylinder

pub(crate) fn add_cylinder(s: &mut Solid, center: DVec2, radius: f64, z0: f64, z1: f64)

A vertical cylinder: flat top and bottom, its side as smooth facets.

fn add_ring

pub(crate) fn add_ring(s: &mut Solid, center: DVec2, inner: f64, outer: f64, z0: f64, z1: f64)

A vertical annulus: flat top and bottom (one quad per chord), its inner and outer sides as smooth facets.

cc_geom::plan_cover

crates/cc_geom/src/plan_cover.rs

Hidden lines of plans. A plan sees what lies below its cut plane from above: an edge shows only where no face lies over it, so the faces of the pieces turned up below the cut plane, and their sections at it, hide the parts of the edges they cover from above. The test is exact for planar faces: an edge is cut where it crosses the outline of a face seen from above, and along each stretch inside the outline the height of the face over the edge varies linearly, so the stretch is hidden from where the face rises above the edge. A margin (a line’s width on paper) also hides what runs that close along the outline of a face over it, which would only thicken that outline.

Items: PlanCover

struct PlanCover

pub struct PlanCover

What hides edges in a plan cut at cut_z (see the module): faces and sections added, then edges asked about with PlanCover::visible.

Traits: Debug, Clone

Some fields are private.

Methods

cc_geom::polygon

crates/cc_geom/src/polygon.rs

2D polygon helpers.

Items: signed_area · area · perimeter · MAX_HULL_POINTS · convex_hull · ccw · offset · contains · triangulate · triangulate_with_holes · keyhole · clip_line · closest_on_segment · line_intersect · segment_meets_rect

fn signed_area

pub fn signed_area(poly: &[DVec2]) -> f64

Signed area (positive for counter-clockwise).

fn area

pub fn area(poly: &[DVec2]) -> f64

fn perimeter

pub fn perimeter(poly: &[DVec2]) -> f64

const MAX_HULL_POINTS

pub const MAX_HULL_POINTS: usize

Most points convex_hull takes; the rest are left out.

fn convex_hull

pub fn convex_hull(points: &[DVec2]) -> Vec<DVec2>

The convex hull of points, counter-clockwise, without collinear points (Andrew’s monotone chain). Non-finite points are skipped; fewer than three distinct points give them back as they are.

fn ccw

pub fn ccw(poly: &[DVec2]) -> Vec<DVec2>

Copy of poly wound counter-clockwise.

fn offset

pub fn offset(poly: &[DVec2], d: f64) -> Vec<DVec2>

Offset a simple polygon outward by d using mitered corners.

fn contains

pub fn contains(poly: &[DVec2], pt: DVec2) -> bool

fn triangulate

pub fn triangulate(poly: &[DVec2]) -> Vec<[usize; 3]>

Triangulate a simple polygon; returns index triples (none when a point is not finite: earcutr panics on such input).

fn triangulate_with_holes

pub fn triangulate_with_holes(outer: &[DVec2], holes: &[Vec<DVec2>]) -> Vec<[DVec2; 3]>

Triangulate a polygon with holes; triangles keep the winding of outer.

fn keyhole

pub fn keyhole(outer: &[DVec2], holes: &[Vec<DVec2>]) -> Option<Vec<DVec2>>

One ring covering outer less holes (simple, inside it, apart): the outline counter-clockwise with each hole, clockwise, joined to it by a bridge walked there and back. A single polygon with holes, for painters and formats that fill one ring (nonzero and even-odd fills both leave the holes out). None when a bridge could not be found within the work limit or the input is degenerate; callers then fall back to triangulate_with_holes.

fn clip_line

pub fn clip_line(poly: &[DVec2], origin: DVec2, dir: DVec2) -> Vec<(f64, f64)>

Parts of the infinite line origin + t*dir inside poly, as (t0, t1) pairs.

fn closest_on_segment

pub fn closest_on_segment(a: DVec2, b: DVec2, p: DVec2) -> (DVec2, f64)

Closest point on segment a-b to p and the segment parameter.

fn line_intersect

pub fn line_intersect(p1: DVec2, d1: DVec2, p2: DVec2, d2: DVec2) -> Option<f64>

Intersection of lines p1 + t*d1 and p2 + s*d2, returning t.

fn segment_meets_rect

pub fn segment_meets_rect(a: DVec2, b: DVec2, lo: DVec2, hi: DVec2) -> bool

Whether segment a–b passes through the rectangle lo..hi (Liang–Barsky clipping; touching counts).

cc_geom::profile_sweep

crates/cc_geom/src/profile_sweep.rs

The solid of a swept profile: its type’s profile carried along its path in plan, at the level’s elevation plus its base offset, mitered at the corners (and around a closed path).

Items: sweep_profile · sweep_faces

fn sweep_profile

pub fn sweep_profile(project: &Project, element: &Element, sweep: &Sweep) -> Option<Vec<DVec2>>

The profile of a sweep’s type, on the side the sweep puts it.

fn sweep_faces

pub fn sweep_faces(project: &Project, element: &Element, sweep: &Sweep) -> Option<Vec<Vec<DVec3>>>

The faces of a sweep (outward), or None when its path or profile cannot make one.

cc_geom::ramp

crates/cc_geom/src/ramp.rs

Ramp geometry: the sloped flights and flat landings of a ramp element laid out from its shape, its slab solids and the paths its railings follow. Like stairs, shapes are built in a local frame (a, b): a along the first flight from the middle of its foot, b across it towards the side the ramp turns to; a ramp turning right is the mirror image.

Items: RampPiece · RampGeom · ramp_geom · layout_ramp

struct RampPiece

pub struct RampPiece

One surface of a ramp: a sloped flight or a flat landing.

Traits: Debug, Clone, PartialEq

Fields

struct RampGeom

pub struct RampGeom

Layout of a ramp element.

Traits: Debug, Clone, PartialEq

Fields

Methods

fn ramp_geom

pub fn ramp_geom(project: &Project, element: &cc_core::Element, ramp: &cc_core::Ramp) -> Option<RampGeom>

Layout of a ramp element from its type, constraints and shape.

fn layout_ramp

pub fn layout_ramp(start: DVec2, u: DVec2, width: f64, base: f64, top: f64, rules: &RampRules, layout: RampLayout) -> RampGeom

Lay out a ramp from its foot start, first-flight direction u, width and elevations.

cc_geom::rebar

crates/cc_geom/src/rebar.rs

Reinforcing bars: the center lines of each set of bars in its beam or column, from the host’s body, the cover and the bar diameters. Longitudinal bars sit inside the stirrups (cover plus the host’s largest stirrup diameter); stirrups are closed loops cover inside the faces, spaced evenly and centered along the host. Along an arc beam the bars follow the arc, each at its own radius, and the stirrups are radial. Top and bottom bars that do not fit side by side go in further layers, side bars run between them, and bars longer than the stock length are spliced. A column’s bars stand around its section (crate::faces): a count spread around it, or so many on each face with the corner bars shared; its ties follow the section’s outline, cross-ties link the bars between the corners to the bars opposite, and the vertical bars may be cut in lifts that lap.

Items: STEEL_DENSITY · MAX_BARS · Bar · RebarGeom · stations · build_rebar · run_past · column_faces · hook

const STEEL_DENSITY

pub const STEEL_DENSITY: f64

Density of steel, kg/m³.

const MAX_BARS

pub(crate) const MAX_BARS: usize

At most this many bars in one set, splice pieces included.

struct Bar

pub struct Bar

One bar: its center line, closed for stirrups.

Traits: Debug, Clone, PartialEq

Fields

Methods

struct RebarGeom

pub struct RebarGeom

The bars of one reinforcement set.

Traits: Debug, Clone, PartialEq

Fields

Methods

fn stations

pub(crate) fn stations(a: f64, b: f64, spacing: f64) -> Vec<f64>

Positions spacing apart filling [a, b], centered.

fn build_rebar

pub fn build_rebar(project: &Project, beams: &BTreeMap<ElementId, BeamGeom>, walls: &BTreeMap<ElementId, crate::WallGeom>, foundations: &BTreeMap<ElementId, crate::FoundationGeom>) -> BTreeMap<ElementId, RebarGeom>

Bars of every reinforcement set whose host has a body.

fn run_past

pub(crate) fn run_past(inside: (f64, f64), cover: f64, past: (f64, f64), scale: f64) -> (f64, f64)

The stretch of the axis a bar along its host covers: inside is the stretch the cover clear of both end faces, and where the bar runs past an end (a length on its own line, scale times the axis’s) it starts that far beyond the face instead.

fn column_faces

pub fn column_faces(project: &Project, data: &TypeData, inset: f64) -> Vec<SectionFace>

The faces of a column type’s section inset inside it, in the order bars are given face by face: counter-clockwise, an annular sector’s from its outer arc. Empty for other types and failed sections.

fn hook

pub(crate) fn hook(turn: f64, d: f64) -> f64

Length of a tie’s hook bent by turn radians: the bend around a pin three bar diameters across, then a straight end of five diameters (at least 5 cm).

cc_geom::region

crates/cc_geom/src/region.rs

Regions covered by polygons: the union of simple polygons in a plane, optionally less what other polygons cover and kept within another polygon, as rings a painter can fill. The polygons’ edges are first welded (weld): points closer than a tolerance become one, and every edge is split where another crosses it or a point lies on it, so the edges meet only at their ends. They go as constraints into a constrained Delaunay triangulation, every triangle is in or out of the region by its centroid, and the region’s outline is the edges between a triangle in it and one out of it: always closed loops, whatever the input. Bounded by the number of points and edges, errors as values.

Items: covered · covered_except

fn covered

pub fn covered(polys: &[Vec<DVec2>], clip: Option<&[DVec2]>, max_points: usize) -> Option<Vec<Vec<DVec2>>>

The region covered by any of polys (simple polygons of either winding, which may overlap, touch or cross), within clip (a simple polygon) when given: rings to fill, each a simple polygon running counter-clockwise around a piece of the region with its holes joined to the outline by bridges walked there and back (polygon::keyhole; a piece whose holes could not be joined comes as triangles). The rings do not overlap. None when the polygons have more than max_points points in all, a coordinate is not a finite number, the polygons cross one another too many times (MAX_EDGES, MAX_WELD_WORK), the triangulation fails or the outlines found do not make a region (one left open, a hole inside none of them): never a region that covers more than the polygons do. Nothing covered is Some of no rings.

fn covered_except

pub fn covered_except(polys: &[Vec<DVec2>], except: &[Vec<DVec2>], clip: Option<&[DVec2]>, max_points: usize) -> Option<Vec<Vec<DVec2>>>

The region covered by any of polys and by none of except (simple polygons too, of either winding, which may overlap one another and the others), within clip when given: rings as covered gives them, and None in the same cases, the points of except counting among the max_points.

cc_geom::roof_framing

crates/cc_geom/src/roof_framing.rs

Roof framing: the purlins, rafters and battens under a roof’s sloped faces, from its type’s framing and covering (see cc_core::roofing). Each sloped underside of the roof’s body is framed on its own: battens along the eaves at the tile’s gauge, right under the roof; rafters down the slope under the battens; purlins along the eaves under the rafters, spread evenly from eave to ridge no farther apart than the purlin step. Steel framing has purlins only, right under the sheets. Members are boxes with their height across the roof plane. Coplanar faces are framed together (a face with openings comes as several polygons).

Items: MemberKind · TrussPart · Member · RoofFramingGeom · roof_framing

enum MemberKind

pub enum MemberKind

Traits: Debug, Clone, Copy, PartialEq, Eq, Hash

Variants

enum TrussPart

pub enum TrussPart

The part of a truss a member is.

Traits: Debug, Clone, Copy, PartialEq, Eq, Hash

Variants

struct Member

pub struct Member

A framing member: its axis (along the roof plane), section, the in-plane direction its width runs along and the direction its height runs down (away from the roof), with the depth below the roof’s underside where it starts.

Traits: Debug, Clone, Copy, PartialEq

Fields

Some fields are private.

Methods

struct RoofFramingGeom

pub struct RoofFramingGeom

The framing of one roof and the figures of its covering.

Traits: Debug, Clone, Default, PartialEq

Fields

Methods

fn roof_framing

pub fn roof_framing(roof: &Solid, framing: &RoofFraming, covering: Option<TileKind>) -> RoofFramingGeom

The framing under a roof’s body roof (its solid) for framing and covering.

cc_geom::roofs

crates/cc_geom/src/roofs.rs

Pitched roofs (gable and hip) over any footprint, courtyards included: every sloped eave raises a plane and every gable edge a vertical plane; the weighted straight skeleton (crate::skeleton) gives the part of each plane over the footprint, with its hips, valleys and ridges. The older construction, kept as a fallback when the skeleton fails, takes the lowest of the planes rising from each sloped eave: right for convex footprints only.

Items: Eave · edge_slopes · ccw_edge_slopes · sloped_eaves · roof_regions · ridge_lines · add_pitched_roof · plan_area · eave_weights · add_skeleton_roof

struct Eave

pub struct Eave

One plane of a pitched roof: rises with slope from the eave through a (counter-clockwise footprint, so the inside is on the left).

Traits: Debug, Clone, Copy

Fields

Methods

fn edge_slopes

pub fn edge_slopes(pts: &[DVec2], slope: f64, ridge: Option<DVec2>, own: &[Option<f64>]) -> Vec<f64>

The slope of each edge of a counter-clockwise loop: its own slope when own sets one (0 = a gable end), else slope on a hip roof (no ridge) or on edges within 45° of the ridge direction, 0 on the others.

fn ccw_edge_slopes

pub fn ccw_edge_slopes(r: &cc_core::Roof) -> Vec<Option<f64>>

A roof’s own edge slopes in the order of its counter-clockwise outline (polygon::ccw reverses a clockwise footprint, and with it the edges).

fn sloped_eaves

pub fn sloped_eaves(footprint: &[DVec2], slopes: &[f64]) -> Vec<Eave>

The sloped eaves of a counter-clockwise footprint, given the slope of each edge (see edge_slopes); edges of slope 0 are gables.

fn roof_regions

pub fn roof_regions(footprint: &[DVec2], eaves: &[Eave]) -> Vec<(usize, Vec<DVec2>)>

Part of the footprint owned by each eave’s plane (empty parts are skipped).

fn ridge_lines

pub fn ridge_lines(footprint: &[DVec2], regions: &[(usize, Vec<DVec2>)]) -> Vec<(DVec2, DVec2)>

Ridge and hip lines in plan: region edges that are not on the footprint boundary.

fn add_pitched_roof

pub fn add_pitched_roof(solid: &mut Solid, footprint: &[DVec2], eaves: &[Eave], base: f64, thickness: f64)

Add the closed solid of a pitched roof of vertical thickness thickness whose underside is at base along the eaves.

fn plan_area

pub fn plan_area(r: &cc_core::Roof) -> f64

Plan area covered by a roof: its outline grown by the overhang, less its openings shrunk by it.

fn eave_weights

pub fn eave_weights(loops: &[Vec<DVec2>], slope: f64, ridge: Option<DVec2>, own: &[Option<f64>]) -> Vec<Vec<f64>>

Edge weights of a footprint’s loops for the skeleton: sloped eaves move in by 1 / slope per unit of height, gables (see edge_slopes) stay. own holds the outline’s own edge slopes; openings follow the shape.

fn add_skeleton_roof

pub fn add_skeleton_roof(solid: &mut Solid, sk: &crate::skeleton::Skeleton, base: f64, thickness: f64)

Add the closed solid of a roof from its skeleton: each plane’s part lifted from base (its underside) with thickness measured vertically, flat tops where the planes never close, and vertical faces along the eaves and the gables.

cc_geom::rooms

crates/cc_geom/src/rooms.rs

Room boundaries: the region enclosed by room-bounding walls around a point. The wall footprints form a planar arrangement once their edges are split where they meet. A ray from the room point finds the nearest edge, and the face containing the point is traced by turning as far left as possible at every vertex. Openings do not break the boundary (footprints are full walls).

Items: room_boundary · RoomArrangement · outer_boundary

fn room_boundary

pub fn room_boundary(walls: &[Vec<DVec2>], point: DVec2) -> Option<Vec<DVec2>>

Boundary (counter-clockwise) of the region enclosed by walls (wall footprints) that contains point, or None if the point is not enclosed.

struct RoomArrangement

pub struct RoomArrangement

The arrangement of a set of wall footprints, made once to find the boundaries of many rooms among the same walls (see room_boundary).

Some fields are private.

Methods

fn outer_boundary

pub fn outer_boundary(lines: &[Vec<DVec2>]) -> Option<Vec<DVec2>>

The outer boundary (counter-clockwise) of the arrangement of lines (open polylines, such as wall location lines): the loop around the largest enclosed area, with lines inside it and lines hanging off it left out. None when the lines enclose nothing.

cc_geom::section

crates/cc_geom/src/section.rs

Cross-sections of columns and beams: type sections at each detail level, placed column bodies with smooth arc facets, and the legacy section shapes as rectangles and outlines (legends and IFC export).

Items: shape_rects · shape_loops · detailed · detailed_section · column_body · smooth_sides · add_column_body

fn shape_rects

pub fn shape_rects(shape: SectionShape, width: f64, depth: f64) -> Vec<(DVec2, DVec2)>

The solid parts of a profile in its width x depth box centered at the origin, as (min, max) rectangles that do not overlap.

fn shape_loops

pub fn shape_loops(shape: SectionShape, width: f64, depth: f64) -> Vec<Vec<DVec2>>

The outlines of a profile (outer boundary, then holes), counter-clockwise.

fn detailed

pub fn detailed(project: &Project, data: &TypeData, detail: DetailLevel) -> Option<SectionOutline>

The section of a column or beam type at a detail level: Fine the outline with radii, Medium without (arcs replaced by their chords’ corners: rebuild the profile with r/ri/ro = 0), Coarse its bounding rectangle.

fn detailed_section

pub fn detailed_section(project: &Project, data: &TypeData, detail: DetailLevel) -> Option<TypeSection>

detailed with whether the outline has arcs.

fn column_body

pub fn column_body(section: &SectionOutline, position: DVec2, rotation_deg: f64) -> (Vec<DVec2>, Vec<Vec<DVec2>>)

Solid parts of a column (outline + holes) placed in plan.

fn smooth_sides

pub fn smooth_sides(ring: &[DVec2]) -> Vec<bool>

Whether each side of a closed ring (from point i to i + 1) is a facet of an arc: the ring turns by less than SMOOTH_TURN_DEG at both ends, and the side is at most SMOOTH_LENGTH_RATIO times as long as the shorter of its neighbors (so a long flat side between two fillets stays flat).

fn add_column_body

pub fn add_column_body(s: &mut Solid, outer: &[DVec2], holes: &[Vec<DVec2>], base: f64, top: f64, curved: bool)

Add a column body from base to top to s; the sides of a curved section that are facets of its arcs are smooth.

cc_geom::sizing

crates/cc_geom/src/sizing.rs

Sizing of building services from their networks, with simplified tables of common Brazilian practice (from public sources):

Items: MAX_SPEED · MAX_DROP · PipeSizing · CircuitSizing · drain_diameter · water_flow · water_diameter · size_pipes · size_circuits

const MAX_SPEED

pub const MAX_SPEED: f64

Maximum speed in water pipes, m/s.

const MAX_DROP

pub const MAX_DROP: f64

Maximum voltage drop of a circuit, percent.

struct PipeSizing

pub struct PipeSizing

The sizing of one pipe run.

Traits: Debug, Clone, PartialEq

Fields

Methods

struct CircuitSizing

pub struct CircuitSizing

The sizing of one circuit.

Traits: Debug, Clone, PartialEq

Fields

Methods

fn drain_diameter

pub fn drain_diameter(units: f64, toilet: bool) -> f64

The required drain diameter (m) for units fixture units.

fn water_flow

pub fn water_flow(weights: f64) -> f64

Flow (l/s) from the sum of relative weights.

fn water_diameter

pub fn water_diameter(flow: f64) -> f64

The smallest PVC water pipe (outside diameter, m) for flow l/s.

fn size_pipes

pub fn size_pipes(project: &Project, geom: &ModelGeometry) -> Vec<PipeSizing>

Sizes the drains and water pipes of every plumbing system.

fn size_circuits

pub fn size_circuits(project: &Project, geom: &ModelGeometry) -> Vec<CircuitSizing>

Sizes every electrical circuit.

cc_geom::skeleton

crates/cc_geom/src/skeleton.rs

Weighted straight skeleton of a polygon with holes, for roofs. Every edge of the footprint is the eave of a roof plane rising inwards; its weight is how far the plane’s line moves inwards per unit of height (1 / slope), and 0 for a gable (a vertical plane that stays put). The skeleton follows the textbook wavefront simulation: the edges move in at their speeds, each vertex along the line where its two planes meet, and the topology changes at two kinds of events:

Items: SkeletonError · Plane · Skeleton · skeleton

enum SkeletonError

pub enum SkeletonError

Why a skeleton could not be computed.

Traits: Debug, Clone, Copy, PartialEq, Eq

Variants

struct Plane

pub struct Plane

One roof plane: its eave line, inward normal and speed.

Traits: Debug, Clone, Copy, PartialEq

Fields

Methods

struct Skeleton

pub struct Skeleton

The skeleton of a footprint.

Traits: Debug, Clone, Default, PartialEq

Fields

Methods

fn skeleton

pub fn skeleton(loops: &[Vec<DVec2>], weights: &[Vec<f64>]) -> Result<Skeleton, SkeletonError>

The weighted straight skeleton of loops (the outer boundary counter-clockwise, holes clockwise: the interior on the left of every edge), with weights[l][i] the inward speed of edge i of loop l per unit of height (0 for a gable).

cc_geom::slab_rebar

crates/cc_geom/src/slab_rebar.rs

Slab reinforcement: the bars of floors and foundation slabs. Straight bars of a mesh, ring and radial bars, and trimming bars around openings lie in the slab’s top or bottom layer, cover inside its faces, edge and openings. Each bar is clipped to the region the cover leaves, so every bar has its own length; where the boundary was drawn with arcs or circles the bars end on the true curve, not on its chords.

Items: Slab · Region · Stretch · slab_bars

struct Slab

pub(crate) struct Slab

A slab as its bars see it.

Traits: Debug, Clone, PartialEq

Fields

Methods

struct Region

pub(crate) struct Region

Where bars may lie: inside the boundary and outside the openings, the cover clear of both.

Some fields are private.

Methods

struct Stretch

pub(crate) struct Stretch

A stretch of a line inside the region, and whether each end lies on the slab’s own edge.

Traits: Debug, Clone, Copy, PartialEq

Fields

fn slab_bars

pub(crate) fn slab_bars(slab: &Slab, r: &Rebar, d: f64, other: f64) -> Vec<Bar>

The bars of the set r (bars d thick) in slab; other is the largest bar of the other sets of its layer, which an inner set lies inside.

cc_geom::solid

crates/cc_geom/src/solid.rs

Items: Face · SMOOTH_COS · Solid · plane_axes · Look · Ray · curved_facets · ray_box

struct Face

pub struct Face

A planar polygon face with an outward normal.

Traits: Debug, Clone, PartialEq

Fields

Methods

const SMOOTH_COS

pub(crate) const SMOOTH_COS: f64

Smooth facets meeting at less than this angle (cosine) read as one surface.

struct Solid

pub struct Solid

Boundary representation of one element (or a part of one).

Traits: Debug, Clone

Fields

Methods

fn plane_axes

pub fn plane_axes(n: DVec3) -> (DVec3, DVec3)

The axes a texture is laid along on a face with normal n: plan X and Y on faces turned up or down, else level across the face (to the right, seen from outside) and up its slope. A point’s plane coordinates are its dot products with them, in meters (see Solid::facet_shifts).

struct Look

pub struct Look

How a material shows on a face: shading color, appearance color, surface pattern and transparency, and the material’s name (for its texture).

Traits: Debug, Clone, PartialEq

Fields

Methods

struct Ray

pub struct Ray

Traits: Debug, Clone, Copy

Fields

fn curved_facets

pub fn curved_facets(polygons: &[Vec<DVec3>]) -> Vec<bool>

Which of polygons (the faces of one closed piece, such as a component piece) are facets of curved surfaces (see Solid::smooth_curved), one flag per polygon; degenerate polygons are not.

fn ray_box

pub(crate) fn ray_box(ray: Ray, lo: DVec3, hi: DVec3) -> Option<f64>

Distance along ray at which it enters the box lo-hi (grown by a small margin; 0 from inside), if it meets the box ahead.

cc_geom::stair

crates/cc_geom/src/stair.rs

Stair geometry: the treads, landings and winders of a stair element laid out from its shape, the solids of its construction (solid, cast in place, assembled) and the paths its railings follow. Shapes are built in a local frame (a, b): a along the first flight from the foot of the first riser, b across it towards the side the stair turns to; a stair turning right is the mirror image.

Items: StepKind · StairStep · Flight · StairLanding · LandingRect · Spiral · StairGeom · Pieces · add_wedge · stair_geom · layout_stair · railing_path · railing_length · add_railing · railing_pieces

enum StepKind

pub enum StepKind

What a stair step is.

Traits: Debug, Clone, Copy, PartialEq, Eq

Variants

struct StairStep

pub struct StairStep

One walking surface of a stair: a tread, winder or landing.

Traits: Debug, Clone, PartialEq

Fields

struct Flight

pub struct Flight

A straight flight: its treads go up along dir from origin (the middle of its first riser).

Traits: Debug, Clone, Copy, PartialEq

Fields

struct StairLanding

pub struct StairLanding

The frame of a landing: its center, the unit vectors along the flight arriving at it and across it (to the side the stair turns to), its half sizes along them and the center lines of the flights it joins. Landing coordinates (x, y) are along and across from the center.

Traits: Debug, Clone, Copy, PartialEq

Fields

Methods

type alias LandingRect

pub type LandingRect = [f64; 4]

A rectangle [x0, x1, y0, y1] in landing coordinates.

struct Spiral

pub struct Spiral

A spiral stair’s circle.

Traits: Debug, Clone, Copy, PartialEq

Fields

struct StairGeom

pub struct StairGeom

Layout of a stair element.

Traits: Debug, Clone, PartialEq

Fields

Some fields are private.

Methods

type alias Pieces

pub type Pieces = Vec<Vec<Vec<DVec3>>>

Closed solids, each a list of planar polygons wound outward.

fn add_wedge

pub(crate) fn add_wedge(s: &mut Pieces, outline: &[DVec2], bottom: &[f64], top: &[f64])

A prism over outline with an elevation per vertex at the bottom and the top; uneven faces are split into triangles.

fn stair_geom

pub fn stair_geom(project: &Project, element: &cc_core::Element, stair: &cc_core::Stair) -> Option<StairGeom>

Layout of a stair element from its type, constraints and shape.

fn layout_stair

pub fn layout_stair(start: DVec2, u: DVec2, width: f64, base: f64, top: f64, max_riser: f64, tread: f64, rules: &StairRules, mut layout: StairLayout) -> StairGeom

Lay out a stair from its foot start, first-flight direction u, width and elevations.

fn railing_path

pub fn railing_path(project: &Project, element: &cc_core::Element, railing: &cc_core::Railing) -> Vec<DVec3>

Path of a railing with elevations: along its stair’s or ramp’s side when it has one, else its own path at its base.

fn railing_length

pub fn railing_length(project: &Project, element: &cc_core::Element, railing: &cc_core::Railing) -> f64

Length of a railing along its (sloped) path.

fn add_railing

pub fn add_railing(project: &Project, element: &cc_core::Element, railing: &cc_core::Railing, solid: &mut Solid)

Add a railing’s solids: a top rail its type’s height above the path and posts at the path’s corners and every post_spacing along it.

fn railing_pieces

pub fn railing_pieces(project: &Project, element: &cc_core::Element, railing: &cc_core::Railing) -> Pieces

The rail and posts of a railing as closed pieces.

cc_geom::strip

crates/cc_geom/src/strip.rs

Arc strip footings: the body of a strip (a ground beam) that follows an arc, a band between concentric arcs either side of its centerline, its ends cut where it meets other strips. Plans draw it as short chords of the arcs; its area and volume are exact.

Items: StripArc

struct StripArc

pub struct StripArc

The plan of an arc strip: half either side of the centerline arc, in strip-local (u, v) (along the arc from its start, and to its left); the left face spans left and the right face right along the arc.

Traits: Debug, Clone, Copy, PartialEq

Fields

Methods

cc_geom::strip_rebar

crates/cc_geom/src/strip_rebar.rs

Strip footing reinforcement: bars across the footing slab (radial in an arc strip), bars along it (ring bars), and the bars of a beam for the beam on top of a haunched strip (or the whole section of a plain one). Top bars follow the top of the footing: up its slopes and flat between the faces of its beam.

Items: StripSection · strip_bars

struct StripSection

pub(crate) struct StripSection

A strip’s section as its bars see it: its width, the footing’s thickness at the beam, and the beam on top, when it has one.

Traits: Debug, Clone, Copy, PartialEq

Fields

Methods

fn strip_bars

pub(crate) fn strip_bars(g: &BeamGeom, section: &StripSection, r: &Rebar, d: f64, other: f64, past: (f64, f64)) -> Vec<Bar>

The bars of the strip’s own set r (bars d thick): other is the largest bar of the sets of the same layer that run the other way, which the bars along the strip lie inside. The bars along the strip run past its start and end by those lengths instead of stopping the cover short.

cc_geom::topography

crates/cc_geom/src/topography.rs

Terrain surfaces (cc_core::topography): a constrained Delaunay triangulation (spade) of the measured points inside the boundary, with the boundary’s edges as constraints, so non-convex boundaries keep no triangle outside. Boundary vertices take the elevation all the points give them, those beyond the boundary too (linear over the points’ triangulation, the nearest point’s beyond it). The surface closes down to a flat base into a solid; contours cut it at multiples of an interval. The terrain’s building pads then grade the surface (crate::pad), in id order.

Items: MAX_CONTOURS · TopoWarning · TopoGeom · Contour · topo_geom · topo_geom_with_pads · add_solid · contours · contours_of · slice · chain

const MAX_CONTOURS

pub const MAX_CONTOURS: usize

Most contour lines drawn for one surface: the interval doubles until fewer are left.

enum TopoWarning

pub enum TopoWarning

Something about a surface the user should know (shown with the element).

Traits: Debug, Clone, Copy, PartialEq, Eq

Variants

Methods

struct TopoGeom

pub struct TopoGeom

A built terrain surface, in absolute elevations.

Traits: Debug, Clone, PartialEq

Fields

struct Contour

pub struct Contour

A contour line: the surface cut at elevation z.

Traits: Debug, Clone, PartialEq

Fields

fn topo_geom

pub fn topo_geom(project: &Project, e: &Element, t: &Topography) -> Option<TopoGeom>

The surface of terrain t of element e, or None when its boundary is invalid.

fn topo_geom_with_pads

pub fn topo_geom_with_pads(project: &Project, e: &Element, t: &Topography) -> Option<(TopoGeom, Vec<(ElementId, crate::pad::PadGeom)>)>

The surface of terrain t of element e graded by its pads, and each pad’s figures.

fn add_solid

pub fn add_solid(s: &mut Solid, g: &TopoGeom)

The closed solid: the surface on top, a flat base, sides along the boundary.

fn contours

pub fn contours(g: &TopoGeom, interval: f64, major_every: u32, max: usize) -> Vec<Contour>

Contour lines of g every interval (doubled until at most max remain), every major_every-th one a major.

fn contours_of

pub fn contours_of(triangles: &[[DVec3; 3]], (min_z, max_z): (f64, f64), interval: f64, major_every: u32, max: usize) -> Vec<Contour>

Contour lines of triangles (elevations within range), as contours.

fn slice

pub fn slice(triangles: &[[DVec3; 3]], z: f64) -> Vec<(DVec2, DVec2)>

Segments where the plane at z cuts triangles (vertices exactly at z count as just above, so shared edges give no duplicates).

fn chain

pub fn chain(segments: Vec<(DVec2, DVec2)>) -> Vec<Vec<DVec2>>

Join segments that share ends into polylines (bounded by the segment count).

cc_geom::wall

crates/cc_geom/src/wall.rs

Items: Opening · Recess · RECESS_MIN_BACK · Column · WallGeom · LayerGap · EndJoin · WallLine · core_through · embedded_in · resolve_join · arc_band_area

struct Opening

pub struct Opening

A rectangular hole through a wall, in wall-local coordinates.

Traits: Debug, Clone, PartialEq

Fields

struct Recess

pub struct Recess

A recess in one face of a wall (a niche): the wall is open from that face depth in, between u0 and u1 along it and z0 and z1 in height, and whole behind it. Unlike an Opening it does not split the wall into columns: the wall stands there for joins, rooms and bars.

Traits: Debug, Clone, PartialEq

Fields

Methods

const RECESS_MIN_BACK

pub const RECESS_MIN_BACK: f64

The least a recess leaves of its wall behind it, meters.

struct Column

pub struct Column

A vertical slice of a wall between opening boundaries. Its footprint is a quad whose left (+v) edge spans left and right (-v) edge spans right along the wall axis; end columns may be mitered.

Traits: Debug, Clone, PartialEq

Fields

Methods

struct WallGeom

pub struct WallGeom

Resolved wall geometry: frame, joins, openings and columns. Wall-local coordinates are u, the distance along the body centerline from its start, and v, the distance to its left. A straight wall’s frame is origin, dir and normal; an arc wall’s centerline is arc (dir and normal are then its frame at the start), and its faces and layer boundaries are concentric arcs.

Traits: Debug, Clone

Fields

Methods

struct LayerGap

pub struct LayerGap

Where the core of a wall met in a T runs through the outer layers of the wall it meets (layer cleanup): those layers open between the core’s faces.

Traits: Debug, Clone, Copy, PartialEq

Fields

Methods

struct EndJoin

pub(crate) struct EndJoin

How one end of a wall is cut by a neighbor.

Traits: Debug, Clone, Copy

Fields

struct WallLine

pub(crate) struct WallLine

Minimal wall description used while resolving joins.

Traits: Debug, Clone, Copy

Fields

Methods

fn core_through

pub(crate) fn core_through(walls: &[WallLine], me: usize, at_start: bool, host: usize, core: (f64, f64), host_core: (f64, f64)) -> Option<((f64, f64), LayerGap)>

Layer cleanup at a T: the end of walls[me] (core faces at offsets core) runs its core on through the outer layers of walls[host] on its side, to the host’s core (faces at host_core). Returns the u of the core’s left and right faces’ ends and the host’s gap (merge unset).

fn embedded_in

pub(crate) fn embedded_in(wall: &WallLine, host: &WallLine) -> Option<(f64, f64)>

Where a straight wall (a curtain wall) lies inside another straight wall host, parallel to it and within its faces: the span (u0, u1) along the host it takes up.

fn resolve_join

pub(crate) fn resolve_join(walls: &[WallLine], me: usize, at_start: bool) -> Option<EndJoin>

Resolve the join at one end of walls[me] (at_start selects the end). Faces of arc walls are their true circles; where two faces do not cross the end is cut along the tangent of the arc at the end instead.

fn arc_band_area

pub(crate) fn arc_band_area(a: &Arc, half: f64, left: (f64, f64), right: (f64, f64)) -> f64

Exact plan area of the band half either side of the arc a whose left side spans left and right side right along the arc, its ends cut straight across.

cc_geom::wall_rebar

crates/cc_geom/src/wall_rebar.rs

Wall reinforcement: horizontal bars (ring bars in an arc wall) and vertical bars near each face of a wall’s structure, and ties between the faces. Bars lie cover inside the face of the wall’s core (its whole body when it has no layers), stop at its free ends and around its openings (horizontal bars run to an end joined to another wall), follow the arc of an arc wall at their own radius, and are lap spliced past the stock length.

Items: WallSets · levels · stations · wall_bars

struct WallSets

pub(crate) struct WallSets<'a>

What a set needs to know of the other sets of its wall.

Traits: Debug, Clone, Copy, Default

Fields

fn levels

pub(crate) fn levels(zones: &[SpacingZone], height: f64, cover: f64) -> Vec<f64>

Heights above the base of the horizontal bars of zones in a wall height high: the first cover up, each next one the spacing of the zone it starts in further, the last at most cover below the top.

fn stations

pub(crate) fn stations(range: (f64, f64), spacing: f64, offset: f64, cover: f64) -> Vec<f64>

Positions along the wall of its vertical bars: every spacing from offset after cover inside the start, to cover inside the end.

fn wall_bars

pub(crate) fn wall_bars(g: &WallGeom, r: &Rebar, d: f64, sets: &WallSets) -> Vec<Bar>

The bars of the set r (bars d thick) in the wall g.