docs/kitbash.md: Hard plates; plate fixtures one row a line
The section states the brokkr.plates.v0 table (rows, solid forms, clad, anchors, sides), the hull and facet rules, what build returns, the refusals, and how the three mech fixtures are held, with the eleven plates the branches' float32 builders keep apart. The fixtures are rewritten one table row a line; their content is unchanged. Cut hard-plate-core. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
This commit is contained in:
parent
ed2ed9eeb8
commit
3acd7faddb
4 changed files with 234 additions and 4462 deletions
|
|
@ -833,6 +833,158 @@ evaluate, but deleting the copy costs the same whole evaluation (1.44 to 1.54 s
|
|||
included, and the hole cut's temporary objects must be deleted too. So a hull with twenty cutters pays their
|
||||
evaluation once for every `ribs` call; iterate planes on the cage before it is cut, or with its Booleans off.
|
||||
|
||||
## Hard plates
|
||||
|
||||
`brokkr_kitbash/plate.py` owns a hard armour plate's geometry: a convex faceted solid, every facet flat, with
|
||||
raised detail panels, a bolt inside each panel corner, and the frames of what stands on it. It is numpy and the
|
||||
standard library, as `core.py` and `route.py` are, and it is a library so far: `plate.check(document)` and
|
||||
`plate.build(table, side=1)`. No action calls it yet and nothing here makes a Blender object. A plate the concept
|
||||
draws curved is a shell (Making a shell); the two do not call each other.
|
||||
|
||||
A plate table is a data document:
|
||||
|
||||
```json
|
||||
{"schema": "brokkr.plates.v0", "plates": [
|
||||
{"name": "Thigh.Shield", "mat": "khaki", "bevel": 0.022,
|
||||
"slab": {"at": [0.02, 0.9, -0.5], "normal": [0.06, 1, 0.05], "up": [0, 0, 1], "right": [1, 0, 0],
|
||||
"outline": [[-0.42, 0.98], [0.42, 0.98], [0.66, 0.5], [0.66, -0.52], [0.42, -1.0], [-0.42, -1.0], [-0.66, -0.52], [-0.66, 0.5]],
|
||||
"thick": 0.26, "taper": 0.04},
|
||||
"clad": {"mat": "olive_light", "min_area": 0.2, "lifts": [0.05, 0.05], "inset": 0.075, "gap": 0.045, "split": 99.0, "seed": 948708},
|
||||
"fits": [{"kind": "mark", "id": "tri", "at": [0.0, -0.05], "height": 0.5}]}
|
||||
]}
|
||||
```
|
||||
|
||||
Coordinates are metres in the table's own frame. The module never sees a host or a world: whoever stands the
|
||||
plates somewhere owns that matrix. The table alone decides the result. A table holds 1 to 256 rows.
|
||||
|
||||
### A row
|
||||
|
||||
| key | value |
|
||||
| --- | --- |
|
||||
| `name` | 1 to 48 of `a-z A-Z 0-9 _ .`, unique among the plates built |
|
||||
| `mat` | a material name, 1 to 63 characters; the caller resolves it |
|
||||
| `bevel` | 0 to 0.1 (default 0): the width of the chamfer the caller's Bevel gives every edge; carried, not built |
|
||||
| `sides` | `"one"` (default) or `"both"`: built at `side` and at `-side`, named `<name>.R` at side +1 and `<name>.L` at -1 |
|
||||
| `mirror` | `true`: the solid is the hull of its points and their x-mirrors, one solid across x = 0 |
|
||||
| one solid form | `faces`, `slab`, `sections` or `points` (below) |
|
||||
| `clad` | `null` or the detail plating (below) |
|
||||
| `face` | `{at, normal, up, right}`: the face anchors stand on, for a row that is not a slab |
|
||||
| `fits` | anchors (below) |
|
||||
|
||||
`mirror` and `sides` are independent. Side -1 negates x of every point before the hull is built, so facets,
|
||||
panels and anchors are those of the mirrored solid as built.
|
||||
|
||||
### Solid forms
|
||||
|
||||
Each form gives points; the plate is their convex hull.
|
||||
|
||||
- `faces`: 4 to 32 half-spaces, each `{at, normal}` (kept where `n . p <= n . at`) or
|
||||
`{through: [a, b, c], out}` (the plane through three points, outward toward `out`). The corners are every three
|
||||
faces' meeting point that lies inside all the others within 1e-6 m. Refused with fewer than four corners or a
|
||||
corner 1000 m or more away.
|
||||
- `slab`: `{at, normal, up, right, outline, thick, taper, back, gap}`. The outline is drawn on the plane through
|
||||
`at` facing `normal`, in (a, b): b is `up` projected into the plane, a is b cross normal, turned toward `right`
|
||||
where one is given. `outline` is 3 to 64 `[a, b]` points in either winding, or `{w, h, clip}`: a w by h
|
||||
rectangle with its corners cut by `clip`. The outline is drawn in by `gap` (default 0) on every edge; the outer
|
||||
face is that ring moved in by `taper` (default 0.04); the ring itself stands `taper` behind the face; the back
|
||||
ring stands `thick` behind, scaled by `back` (default 1) about the ring's middle (the mean of its points).
|
||||
- `slab` by corners: `{corners, names, inside, lift, thick, taper, back, gap, up}`. `corners` is 3 to 64 points;
|
||||
the outer face is their least-squares plane, outward away from `inside`, standing `lift` (default 0.06) off
|
||||
it; the outline is the corners in that plane's frame (`core.surface_frame` at centre + normal x lift). `names`
|
||||
is optional, one distinct name per corner, so a plate blocked by `brokkr_reference.block_plate` can become a
|
||||
row. Corners that stand off their plane by more than 0.05 of their extent (the greatest distance between two
|
||||
of them) are refused: that is not a plate.
|
||||
- `sections`: 2 to 16 `[z, w, y0, y1, c]`, each a rectangle w across x from y0 to y1 at height z with its corners
|
||||
cut c: a housing down a limb.
|
||||
- `points`: 4 to 64 `[x, y, z]`.
|
||||
|
||||
Where each came from on the three mech tracks: `faces` is bastion's carapace (`massing.corners`), `slab` paladin's
|
||||
limb armour (`massing.slab_points`) with raptor's `gap`, the corners slab raptor's hull plates
|
||||
(`raptor_body.wedge_plate`), `sections` paladin's and raptor's limb housings, `points` all three.
|
||||
|
||||
### The hull and its facets
|
||||
|
||||
The module builds the hull itself. A facet is every plane through three points that has all points on its inner
|
||||
side, taken once for the set of points on it and ordered by angle about their middle. Then two rules, both at
|
||||
0.5 degrees: adjacent facets whose normals are closer than that are one facet, and a vertex left with two edges
|
||||
that turn less than that is dropped.
|
||||
|
||||
Facets are ordered by area, largest first; areas within 1e-9 m2 tie and go to the greater centre by x, then y,
|
||||
then z (the centre is the mean of the facet's vertices). The order is computed on the solid as built in the table
|
||||
frame, never from where the plate stands or from a mesh's order, and it decides which facet draws from the seed
|
||||
first.
|
||||
|
||||
### Clad
|
||||
|
||||
`clad` raises a panel on each chosen facet:
|
||||
|
||||
| key | value |
|
||||
| --- | --- |
|
||||
| `mat` | the panels' material |
|
||||
| `facets` | `"outer"` (a slab's default): facets whose normal on the face's normal is over 0.97. `"all"`. Or 1 to 8 selectors, any of which chooses: `{n, cos}` (normal on `n` over `cos`) or `{radial: axis, min_r, cos}` (the facet's centre stands over `min_r` from the axis through the origin, and its normal on the outward radial is over `cos`). A selector's direction is mirrored with the side. |
|
||||
| `floor` | optional: facets whose normal's z is below it are left bare |
|
||||
| `min_area` | facets under it are left bare |
|
||||
| `lifts` | `[l0, l1]`: how proud panels stand |
|
||||
| `inset` | how far a panel stands in from its facet's edges |
|
||||
| `gap` | the seam between the two panels of a split facet |
|
||||
| `split` | a facet over this area is cut in two |
|
||||
| `seed` | an integer, or `[right, left]` on a row with `sides: "both"`. There is no default. |
|
||||
| `bolt_r` | a bolt's corner radius (default 0.028) |
|
||||
|
||||
One `random.Random(seed)` draws, in facet order. A chosen facet over `split` is cut across its longest edge at a
|
||||
share drawn from 0.36 to 0.64 of that edge, the two parts `gap` apart; edges within 1e-9 m of the longest tie and
|
||||
go to the edge whose middle is greater by x, y, z. Then every chosen facet draws once: under 0.5 the parts take
|
||||
`l0, l1`, otherwise `l1, l0`. A panel is its part moved in by `inset` (a sharp corner moves at most inset / 0.3),
|
||||
refused under a quarter of the part's area or under 0.02 m2; it is a prism from 0.02 below the facet to its lift
|
||||
above, its far rim chamfered 0.02. A hexagonal bolt of radius `bolt_r` stands inside each panel corner, 3.2
|
||||
`bolt_r` in.
|
||||
|
||||
### Anchors
|
||||
|
||||
A fit is a frame on the face, at `[a, b]` in the face's (a, b), standing on the face's top: the face, plus
|
||||
`lifts[0]` where a panel stands on it. Two kinds:
|
||||
|
||||
- `{kind: "mark", id, at, height}`: z is the face's normal and y the table's +z projected off it, so a numeral
|
||||
stands upright whatever the plate's lean.
|
||||
- `{kind: "hose_port", name, at, lift}`: z out of the face, y the face's up, `lift` (default 0) further out.
|
||||
|
||||
`build` returns each as `{kind, name, matrix, mirrored}` (and `height` for a mark). At side -1 the position, normal
|
||||
and up are mirrored and the frame is made right-handed again (x = y cross z); `mirrored` says so. What stands on
|
||||
an anchor is its owner's business; the fittings the mech tracks draw on a face (bolt rows, slots, vents, ports,
|
||||
handles, eyes, louvres, steps) are not fits of this table yet, and any other kind is refused.
|
||||
|
||||
### What build returns
|
||||
|
||||
One entry per plate built, in the table's order: `name`, `row` (its index), `mat`, `bevel`, `side`,
|
||||
`solid: (V, faces)`, `facets` (each face's `normal`, `area`, `centre`), `panels: (V, faces)`, `bolts: (V, faces)`,
|
||||
`anchors`, and `report: {corners, facets, panels, bolts}`. `V` is an (N, 3) float64 array; faces are lists of
|
||||
vertex indices wound outward. `check` returns the table with every default written in. Both are pure functions.
|
||||
|
||||
Building the three mech fixtures takes 0.5 to 0.9 s each (23 to 50 plates, medians of 5 on Starfire, Python
|
||||
3.13); the hull tries every plane through three points, so a slab with a 64-point outline takes 1.5 s alone.
|
||||
|
||||
### Refusals
|
||||
|
||||
Every refusal is a `PlateError` (a `ValueError`) that names the path, as `plates[3].slab.outline[2]` or
|
||||
`plates[0].clad.seed`: a schema that is not `brokkr.plates.v0`; an unknown key anywhere; a row with no solid form
|
||||
or two; a name built twice; a number that is not finite; an outline under 3 points or over 64, one that crosses
|
||||
itself, repeats a point or has zero area; `thick`, `taper`, `back` or `gap` outside 0.001 to 2, 0 to 0.5, 0.1 to
|
||||
1.5 and 0 to 0.5; a `taper` of half the outline's least width or more; corners that are not a plate; faces that
|
||||
bound nothing; points in one plane; a pair of seeds on a one-sided row, or no seed; an `up` along the normal; a
|
||||
fit on a row with no face; an unknown fit kind; two anchors of one name in a row.
|
||||
|
||||
### Against the mech tracks' builders
|
||||
|
||||
`tests/fixtures/plates_bastion.json`, `plates_paladin.json` and `plates_raptor.json` each hold a table converted
|
||||
from a mech branch's own numbers and the solids, panels and bolt counts that branch's builder made in Blender
|
||||
5.3; `tests/test_plate.py` holds `build` to them (solid vertices within 1e-6 m, panel vertices within 1e-5 m,
|
||||
facet and bolt counts equal). The branches' builders work in float32 and leave two choices to Blender's mesh
|
||||
order, so eleven of the 126 fixture plates are held to something else, each named in the test's `KNOWN`:
|
||||
eight stand 1 to 2 micrometres (solid) or 29 micrometres (panels) from the float64 result; bastion's two
|
||||
quarter pods lack a corner their faces do bound (the branch's inside test lost it to float32), so its solid is
|
||||
smaller than the table's; and one of bastion's two belly-side plates splits its panel from the other of two
|
||||
equally long edges.
|
||||
|
||||
## Hoses between sockets
|
||||
|
||||
`brokkr_kitbash.hose` routes a bundle of hoses from one socket to another around everything in the scene:
|
||||
|
|
|
|||
1315
surfaces/blender/tests/fixtures/plates_bastion.json
vendored
1315
surfaces/blender/tests/fixtures/plates_bastion.json
vendored
File diff suppressed because it is too large
Load diff
1921
surfaces/blender/tests/fixtures/plates_paladin.json
vendored
1921
surfaces/blender/tests/fixtures/plates_paladin.json
vendored
File diff suppressed because it is too large
Load diff
1308
surfaces/blender/tests/fixtures/plates_raptor.json
vendored
1308
surfaces/blender/tests/fixtures/plates_raptor.json
vendored
File diff suppressed because it is too large
Load diff
Loading…
Reference in a new issue