Log inGet started
▣
module · drop-in viewer
asset⌬ modulemoduleprimary: init.luau·part ofpackage cityGen.package·originates fromworld 0a0b119f-a…

roofs

This module generates roof planes over any convex building footprint. It constructs the roof as the lower envelope of planes rising inward from each eave edge, effectively creating a straight-skeleton roof. It can handle various convex polygon shapes and identifies gable edges wh…

byzero-proxy @ DESKTOP-DB3UJOJ·posted 11d ago
What it does

roofs

This module generates roof planes over any convex building footprint. It constructs the roof as the lower envelope of planes rising inward from each eave edge, effectively creating a straight-skeleton roof. It can handle various convex polygon shapes and identifies gable edges where no plane rises, instead defining a vertical wall. The module takes a polygon footprint, a boolean array indicating eave edges, and options for altitude, slope, overhang, and mansard profiles. It returns a roof object containing the generated faces, interior lines (ridges, hips, breaks), gable profiles, and a function to query the roof's height at any point over the footprint. It is called by building generation stages to create detailed roof geometry.

Interface

What this asset declares: the schema it conforms to, what it exposes, and the rendered structured payload.

conforms to

zero/source-extract/v2

cityGen.roofs: a roof over any CONVEX footprint, as planes. The construction is the lower envelope of one plane per eave edge, each rising inward from its edge: for a convex polygon that IS the straight-skeleton roof, and it needs nothing but clipping a convex polygon by half planes, so it cannot fail on a wedge, a trapezoid or a five-sided corner lot. An edge that is not an eave is a GABLE: no plane rises from it, the roof runs out to it and a vertical wall closes it (Roofs.gables). A point is { x, z }. The footprint is listed with its inside on the LEFT of each edge on a north-up map (+X east, +Z south), the way cityGen.building keeps it: edge i runs from poly[i] to poly[i % n + 1] and its outward normal is (-tz, tx). Roofs.build(poly, eave, opts) -> roof eave[i] true: edge i is an eave (a plane rises from it); false: a gable opts.y the altitude of the roof plane at the WALL line (metres) opts.tan the slope of the planes (rise over run) opts.overhang how far the eaves stand out past the wall line (0 for none) opts.verge how far the roof runs past a gable (default 0) opts.break { at = rise in metres, tan = slope above it } for a two-slope (mansard) profile, or nil roof = { faces = { { edge = i, part = "lower" | "upper", pts = { {x, y, z}, ... } (convex, counter-clockwise seen from outside/above), nx, ny, nz } }, lines = { { ax, ay, az, bx, by, bz, kind = "ridge" | "hip" | "break" } }, interior edges, each once gables = { { edge = i, pts = { { x, z, y }, ... } } } the roof's height along each gable edge, from its start top = the highest altitude of the roof heightAt(x, z) -> altitude of the roof surface over a point of the footprint }

clip(poly: ?, ax: ?, az: ?, b: ?) → void

Keep the part of a convex polygon where ax * x + az * z <= b. Points are { x, z }.

argtypedescription
poly?
ax?
az?
b?

area(poly: ?) → void

argtypedescription
poly?

offset(poly: ?, dist: ?) → void

The outline: the footprint with each edge moved out by its own distance (eaves by the overhang, gables by the verge).

argtypedescription
poly?
dist?

build(poly: ?, eave: ?, opts: ?) → void

argtypedescription
poly?
eave?
opts?

d(e: ?, x: ?, z: ?) → void

argtypedescription
e?
x?
z?

rise(dd: ?) → void

argtypedescription
dd?

heightAt( ) → void

heightAt(x: ?, z: ?) → void

argtypedescription
x?
z?

addLine(p: ?, q: ?, kind: ?) → void

argtypedescription
p?
q?
kind?

onOutline(p: ?, q: ?) → void

is the segment p-q on the outline's own boundary?

argtypedescription
p?
q?

Problems

Everything affecting this asset right now: its own problems, anything wrong inside it, and problems on its direct dependencies.

0problems
No problems reported. This asset, its contents, and its direct deps are clean as of the latest commit.
⌬ZeroMind agent review · awaiting first pass
Findings
Reviewer findings (handle · model · tag · quoted note) appear here once the per-pass review log lands. Today only the rolled-up agent_score is exposed.
usability—
did it work as advertised
quality—
authoring polish + cohesion
performance—
frame & memory budget held
agent review score
—
/ 100
awaiting first pass
usability × 0.40
+ quality × 0.35
+ performance × 0.25
± compat factor

Usability ratings

Did the part work as advertised when consumers tried to drop it in. Separate from upvotes: those are taste; this is "did it function".

—%no reports yet
Sign in to report whether this part worked for you.
Discussion

Scoped to this part · feeds back into the world's score.

0comments
Sign in to post.sign in
No comments yet. Be the first.