cityGen.scMesh: the triangles of a streetscape, and the plane geometry its corners are drawn with.
A `Mesh` gathers positions, normals, one uv and indices. Faces are wound counter-clockwise seen from the side
their normal points to ((b - a) x (c - a) along the normal). `uvx(kind, u)` packs a surface kind into uv.x.
uvx(kind: ?, u: ?) → void
| arg | type | description |
|---|
| kind | ? | |
| u | ? | |
v(x: ?, y: ?, z: ?, nx: ?, ny: ?, nz: ?, u: ?, v: ?) → void
A vertex; answers its index (from 0).
| arg | type | description |
|---|
| x | ? | |
| y | ? | |
| z | ? | |
| nx | ? | |
| ny | ? | |
| nz | ? | |
| u | ? | |
| v | ? | |
tri(a: ?, b: ?, c: ?) → void
| arg | type | description |
|---|
| a | ? | |
| b | ? | |
| c | ? | |
quad(a: ?, b: ?, c: ?, d: ?) → void
a, b, c, d counter-clockwise seen from the face's front.
| arg | type | description |
|---|
| a | ? | |
| b | ? | |
| c | ? | |
| d | ? | |
triUp(a: ?, b: ?, c: ?) → void
A triangle wound so that it faces up, whatever order its corners came in.
| arg | type | description |
|---|
| a | ? | |
| b | ? | |
| c | ? | |
geometry( ) → void
The mesh as a procgen Geometry (nil when it holds nothing).
filter(keep: ?) → void
The triangles whose kind (the whole part of their first corner's uv.x) `keep(kind)` accepts, as a mesh of their own.
append(other: ?) → void
Lay another mesh's triangles into this one.
lineLine(ax: ?, az: ?, adx: ?, adz: ?, bx: ?, bz: ?, bdx: ?, bdz: ?) → void
Plane geometry (x, z)
Where the line through (ax, az) along (adx, adz) meets the line through (bx, bz) along (bdx, bdz): the two
parameters, or nil when they run alongside.
| arg | type | description |
|---|
| ax | ? | |
| az | ? | |
| adx | ? | |
| adz | ? | |
| bx | ? | |
| bz | ? | |
| bdx | ? | |
| bdz | ? | |
area2(poly: ?) → void
Twice the signed area of a polygon given as a list of { x, z }.
earClip(poly: ?) → void
A polygon cut into triangles (ear clipping). Answers a flat list of indices into `poly` (1-based), three a
triangle. Every point of the outline is used, points that lie on a straight run included (a neighbouring strip
has a vertex there). Points nearer than 1 mm to their neighbour should have been dropped by the caller.
cross(a: ?, b: ?, c: ?) → void
| arg | type | description |
|---|
| a | ? | |
| b | ? | |
| c | ? | |
ear(i: ?) → void
Is the corner at i an ear: it turns the outline's own way, and no other point lies in its triangle or on
the diagonal that would close it (such a point would be left without a triangle of its own).
fillet(ax: ?, az: ?, kx: ?, kz: ?, bx: ?, bz: ?, r: ?, step: ?) → void
A circular arc that rounds the corner a -> k -> b with radius r (clamped to what the two legs allow). Answers
the points from a to b (both included), the legs straight where the arc does not reach.
| arg | type | description |
|---|
| ax | ? | |
| az | ? | |
| kx | ? | |
| kz | ? | |
| bx | ? | |
| bz | ? | |
| r | ? | |
| step | ? | |
blend(ax: ?, az: ?, adx: ?, adz: ?, bx: ?, bz: ?, bdx: ?, bdz: ?, k: ?, step: ?) → void
A smooth run from a (heading (adx, adz)) to b (heading (bdx, bdz)): a cubic whose handles are `k` of the chord.
| arg | type | description |
|---|
| ax | ? | |
| az | ? | |
| adx | ? | |
| adz | ? | |
| bx | ? | |
| bz | ? | |
| bdx | ? | |
| bdz | ? | |
| k | ? | |
| step | ? | |
offset(pts: ?, d: ?) → void
A polyline drawn to one side: each point moved `d` along its left normal (d < 0: right), mitred at the turns.
`d` may be a number or a list (one per point).
| arg | type | description |
|---|
| pts | ? | |
| d | ? | |
dedupe(pts: ?, eps: ?, closed: ?) → void
Drop points that sit on their neighbour (closer than `eps`).
| arg | type | description |
|---|
| pts | ? | |
| eps | ? | |
| closed | ? | |