diff --git a/surfaces/blender/brokkr_kitbash/__init__.py b/surfaces/blender/brokkr_kitbash/__init__.py index 19c7090..83f47c5 100644 --- a/surfaces/blender/brokkr_kitbash/__init__.py +++ b/surfaces/blender/brokkr_kitbash/__init__.py @@ -1650,7 +1650,9 @@ class BROKKR_KITBASH_OT_shell(PolishOperator): smooth.levels = smooth.render_levels = self.levels smooth.subdivision_type, smooth.boundary_smooth, smooth.use_creases = "CATMULL_CLARK", built.boundary, True wall = obj.modifiers.get(SOLIDIFY) or obj.modifiers.new(SOLIDIFY, "SOLIDIFY") - wall.thickness, wall.offset, wall.use_even_offset, wall.use_rim = self.thickness, self.offset, True, True + # plain offset: each inner vertex stands the thickness off its outer one along the vertex normal. Even offset divides by the cosine + # of the crease's half-angle, and at a pinned corner of a narrow plate that factor throws a needle (docs/kitbash.md, Thickness at a crease) + wall.thickness, wall.offset, wall.use_even_offset, wall.use_rim = self.thickness, self.offset, False, True sync_bevel(obj, self.bevel) obj[SHELL] = json.dumps({"sheet": document, "thickness": self.thickness, "offset": self.offset, "levels": self.levels, "bevel": self.bevel}) starts = np.cumsum(built.counts) - built.counts diff --git a/surfaces/blender/docs/kitbash.md b/surfaces/blender/docs/kitbash.md index 211bf4e..3ac8bad 100644 --- a/surfaces/blender/docs/kitbash.md +++ b/surfaces/blender/docs/kitbash.md @@ -491,7 +491,7 @@ column 3, the shoulder line, is creased, so the crown and the steep outer face a dips: the plate is concave there, which no convex hull can be. The object carries the cage, `crease_edge` and `crease_vert`, and the modifiers `Kit Subsurf` (`levels`, creases -used) then `Kit Solidify` (`thickness`, `offset`, even, rim filled), then any Booleans `cut` adds, then the `Kit +used) then `Kit Solidify` (`thickness`, `offset`, plain offset, rim filled), then any Booleans `cut` adds, then the `Kit Bevel` when `bevel` is over 0. `kit_shell` on it is the request, and it owns the cage as `kit_params` owns a part's mesh: an edit of the cage by hand is lost at the next `shell` call. `shell` reports `object`, `rebuilt`, `rings`, `points`, `cageFaces`, `creases` (edges with a weight over 0), `folded` (see Thickness at a crease), @@ -513,29 +513,46 @@ the outline, and the plate left between two bites is a tab. it; a rib deeper than the room a tight crease leaves is refused with the size to lower. **Thickness at a crease.** `shell` takes any `thickness` in its range and does not refuse one the cage cannot -hold: the limit is a fact of the subdivided mesh, not of the cage. Even thickness moves a vertex on a -full crease along the crease's bisector, which slides it `thickness` x tan(phi) across each facet, phi being half -the angle between the two facets' normals; the vertices beside it move straight in. Where that slide is longer than -the first row of subdivided faces, the wall's far face folds over itself beside the crease: at a wall depth over -(W / 2^`levels`) / tan(phi), W the width across the crease of the narrower of its two facets. The fold is on the -crease's concave side: behind a ridge, so under a wall grown inward, and in front of a valley, under a wall grown -outward; the two read the same. Measured on two flat facets, a crease of 1.0: the fold starts at 1.00 of that -figure in 23 of 23 readings (W 1 and 0.4; phi 15 to 60; levels 1 to 3; a ridge and a valley), which is 0.217 for W -1, phi 30, levels 3, and 0.029 for W 0.4, phi 60, levels 3. Facets 1.0 and 0.3 wide at phi 45, levels 2, fold at -0.075, the narrow facet's figure, not the wide one's 0.25. A crease of 0.5 folds at 1.02 to 1.32 of it, and an -uncreased edge folds too, at 1.17 to 4.2 of it. The fold is inside the wall and one subdivided row wide: the -designed surface is unchanged and the mesh has no open or non-manifold edge, but the solid passes through itself -there, and a cut through that place is untested. +hold: the limit is a fact of the subdivided mesh, not of the cage. `Kit Solidify` is a plain offset (Even Thickness +off): each vertex of the wall's far face stands `thickness` from its vertex of the designed surface, along that +vertex's normal. On a full crease that normal is the crease's bisector, so the wall there is `thickness` x cos(phi) +thick square to a facet, phi being half the angle between the two facets' normals: 0.71 of it at a right-angled +crease, and the rim strip at a creased corner is narrower by the same factor. A wall of 0.06 reads 0.0539 behind +the pauldron's shoulder crease above. The crease vertex slides `thickness` x sin(phi) across each facet; the +vertices beside it move straight in. Where that slide is longer than the first row of subdivided faces, the wall's +far face folds over itself beside the crease: at a wall depth over (W / 2^`levels`) / sin(phi), W the width across +the crease of the narrower of its two facets. The fold is on the crease's concave side: behind a ridge, so under a +wall grown inward, and in front of a valley, under a wall grown outward; the two read the same. Measured on two +flat facets, a crease of 1.0: the fold starts at 1.00 of that figure in 31 of 31 readings (W 1 and 0.4; phi 15 to +60; levels 1 to 3; a ridge, and a valley at levels 2), which is 0.25 for W 1, phi 30, levels 3, and 0.058 for W +0.4, phi 60, levels 3. Facets 1.0 and 0.3 wide at phi 45, levels 2, fold at 0.106, the narrow facet's figure, not +the wide one's 0.354. A crease of 0.5 folds at 0.72 to 1.14 of it, and an uncreased edge folds too, at 1.21 to 3.3 +of it (three readings each). The fold is inside the wall and one subdivided row wide: the designed surface is +unchanged and the mesh has no open or non-manifold edge, but the solid passes through itself there, and a cut +through that place is untested. -No figure read from the cage bounds this. The flat-facet figure above, taken over every cage edge, is neither a -floor nor a ceiling on a real plate: on seeded lofts of planar trapezoid facets with partial crease runs the -evaluated wall first folded at 0.44 of it with the wall grown inward, at 0.03 of it at `offset` 0 and at 0.08 of it -grown outward, and on the Seraph's plates a first face normal turned at 0.74 to 2.6 of it (`tests/fixtures/fold_lofts.json` holds three of -those lofts; 2026-12-02). So `shell` counts instead of estimating: with `count_folds` it evaluates the wall alone, +Even Thickness would hold the wall at `thickness` square to both facets by moving the crease vertex `thickness` / +cos(phi) along the bisector. That slides it `thickness` x tan(phi) across each facet, so the wall folds sooner, at +(W / 2^`levels`) / tan(phi) (1.00 of it in the same 31 readings), and where creases meet at a pinned corner of a +narrow plate the factor runs away and the wall throws a needle. A plate of a crown ring, a flared skirt and a +domed centre, 0.13 m wide and 1.2 m long, with a wall of 0.04, stood 3.28 thicknesses beyond its cage's bounds +with Even Thickness and stands 0.95 with the plain offset (0.372 m against 0.076 m at a wall of 0.08). A hexagon of +the same make 1.2 m across folded 20 of its 168 inner faces at 0.015, 28 at 0.03 and 44 at 0.07; with the plain +offset it folds 0, 2 and 20. `tests/live/kitbash_cage.py` holds the two plates. Solidify's thickness clamp with +its angle clamp changed no fold count and no bound in either mode, and its complex mode threw a vertex 2.07 m +beyond a 1.0 m plate's cage at a wall of 0.08 (2026-12-03). + +No figure read from the cage bounds this. Of three seeded lofts of planar trapezoid facets with partial crease +runs (`tests/fixtures/fold_lofts.json`), the evaluated wall first folds at 0.042 with the wall grown inward and +at 0.023 grown outward, and at `offset` 0 it folds at the least thickness `shell` takes (2026-12-03). The lofts +were drawn against Even Thickness, where the flat-facet figure of that mode, taken over every cage edge, was +neither a floor nor a ceiling: the wall first folded at 0.44 of it grown inward, at 0.03 of it at `offset` 0 and at +0.08 of it grown outward, and on the Seraph's plates a first face normal turned at 0.74 to 2.6 of it (2026-12-02). +So `shell` counts instead of estimating: with `count_folds` it evaluates the wall alone, `Kit Subsurf` and `Kit Solidify` with every other modifier hidden for the reading and shown again, and reports `folded`, the number of the wall's inner faces that fold. An inner face folds when the turn at any of its corners runs with its outer twin's normal: the corner has passed over its neighbour. That is sooner than the face's own -normal turning: on the Seraph's cap a corner turned at 0.033 and no face normal had at 0.0416. Without `count_folds`, `folded` is null +normal turning: on the Seraph's cap, with Even Thickness, a corner turned at 0.033 and no face normal had at 0.0416. Without `count_folds`, `folded` is null and nothing is evaluated. The count cost 3.9 ms on a new plate of 1600 subdivided faces (a call of 7.7 ms against 3.8 ms), and nothing measurable on a rebuild under six cutters (0.94 s against 0.92 s, the call's own Boolean), medians of three interleaved calls in the live suite (Blender 5.3 on Starfire). On a shell whose `Kit Subsurf` or @@ -543,7 +560,7 @@ medians of three interleaved calls in the live suite (Blender 5.3 on Starfire). `folded` 0 is not yet a wall an Exact Boolean takes cleanly. Short of the fold the inner quads at a tight rim corner are twisted, and the Boolean, which cuts quads into triangles, can read the wall as passing through itself and -leave edges with four faces. On the Seraph's cap that began at 0.91 of the thickness at which the first face +leave edges with four faces. On the Seraph's cap, read with Even Thickness, that began at 0.91 of the thickness at which the first face folds (0.0301 against 0.033), on the left cap and not on its mirror, the right; on its breast plate at 0.91 as well (0.032 against 0.035). Read `nonManifoldEdges` after cutting (`boolean`, `freeze`, or a count on the evaluated mesh), and keep `thickness` clear of the first folding one with a thinner wall, fewer `levels` or wider facets at diff --git a/surfaces/blender/tests/fixtures/fold_lofts.json b/surfaces/blender/tests/fixtures/fold_lofts.json index 566c2b0..adf39d2 100644 --- a/surfaces/blender/tests/fixtures/fold_lofts.json +++ b/surfaces/blender/tests/fixtures/fold_lofts.json @@ -1,12 +1,12 @@ { - "about": "Lofts of planar trapezoid facets on which a shell's wall folds well under any figure read from the cage: the seeded lofts of Soul's probe of 2026-12-02 (aetheria-release:verdict:cut-kit-faceted-shell.s3), seed, levels and offset as drawn there. thickness is one at which the evaluated wall folds; holds, where the action's range reaches it, one at which it does not.", + "about": "Lofts of planar trapezoid facets: the seeded lofts of Soul's probe of 2026-12-02 (aetheria-release:verdict:cut-kit-faceted-shell.s3), seed, levels and offset as drawn there, on which a wall of even offset folded well under any figure read from the cage (at 0.006342, 0.010394 and 0.00617). thickness is one at which the evaluated wall, Kit Solidify's plain offset, folds; holds, where the action's range reaches it, one at which it does not. Read 2026-12-03: seed 5185 first folds at 0.0425 and seed 5196 at 0.0232, thickness and holds standing 1.2 over and under; seed 5101 folds at the range's floor.", "lofts": [ { "seed": 5185, "levels": 1, "offset": -1.0, - "thickness": 0.006342, - "holds": 0.001, + "thickness": 0.051, + "holds": 0.0354, "sheet": { "rings": [ [ @@ -357,8 +357,8 @@ "seed": 5196, "levels": 1, "offset": 1.0, - "thickness": 0.00617, - "holds": null, + "thickness": 0.0279, + "holds": 0.0194, "sheet": { "rings": [ [ diff --git a/surfaces/blender/tests/live/kitbash_cage.py b/surfaces/blender/tests/live/kitbash_cage.py index e3a2724..8976977 100644 --- a/surfaces/blender/tests/live/kitbash_cage.py +++ b/surfaces/blender/tests/live/kitbash_cage.py @@ -1,6 +1,7 @@ """Live proof, in a background Blender, of brokkr_kitbash.shell's free cage through run_intent: a cage of triangles and quads with declared poles becomes a shell whose subdivided face count is the reported one at each level, takes a -wall, counts folds and is cut; a mirrored cage closes over its seam; a loft shell is rebuilt in place as a free cage +wall, counts folds and is cut; a narrow plate's wall throws no needle and a hexagon's thin wall does not fold; a +mirrored cage closes over its seam; a loft shell is rebuilt in place as a free cage under its cutters; the pole gate refuses without writing; tools/cage_export.py reads a cage back, an open one included, as its maker's Subdivision draws it; and tools/cage_score.py ranks a near copy, a moved vertex, an over-creased and a creaseless cage in that order. Not part of the unittest run: it needs Blender. @@ -72,6 +73,13 @@ SAME = 1.3e-2 # Keep Corners, read here by setting it) 7.7; the geometric mean, separation 670 each side. A closed cage does not tell # the two apart, and a hand-modelled hull's own round trip is 0.28 (its seam snap): the open plate stands inside that. OPEN = 1.1e-2 +# Wall thicknesses: how far the furthest vertex of a narrow plate, as evaluated, stands beyond its cage's bounds. +# Shipped 0.95; mutant W1 (Kit Solidify at even offset, read here by setting it: a pinned corner's vertex moves the +# thickness over the cosine of its crease's half-angle) 3.28; the geometric mean, separation 1.86 each side. +NEEDLE = 1.77 +# Inner faces of a hexagon plate's wall that fold, read as the count + 1. Shipped 0, read 1; W1 20, read 21; the +# geometric mean, separation 4.6 each side. +FOLDS = 4.6 # A tent: four triangles round an apex of valence 4 with two ridges creased, and a quad hung under one edge: 7 @@ -82,6 +90,9 @@ TENT = {"verts": [[0.0, 0.0, 0.5], [1.0, 0.0, 0.0], [0.0, 1.0, 0.0], [-1.0, 0.0, HULL = {"verts": [[0.0, -1.0, 0.0], [0.004, 0.0, 0.3], [0.0, 1.0, 0.0], [0.0, 0.0, -0.3], [0.6, 0.0, 0.0]], "faces": [[0, 4, 1], [1, 4, 2], [2, 4, 3], [3, 4, 0]], "creases": [[0, 4, 1.0], [4, 2, 1.0]], "mirror": True} LOFT = {"rings": [[[0.3 * j - 0.45, 0.02 * j * j, 0.3 * i] for j in range(4)] for i in range(3)], "flip": True} +# Two crowns, each the outline of a plate's raised face in the plane y = 0: a strip 0.13 m wide and 1.2 m long, and a hexagon 1.2 m across. +STRIP = [[-0.06, 0.0, 0.6], [-0.07, 0.0, -0.6], [0.07, 0.0, -0.6], [0.06, 0.0, 0.6]] +HEXAGON = [[-0.5, 0.0, 0.6], [-0.62, 0.0, 0.1], [-0.4, 0.0, -0.7], [0.4, 0.0, -0.7], [0.62, 0.0, 0.1], [0.5, 0.0, 0.6]] CUTS = [{"name": "TentLine", "part": "slab", "params": "gap=0.02; length=0.4; depth=0.03", "origin": [0.3, -0.35, 3.0], "direction": [0, 0, -1]}] @@ -132,6 +143,31 @@ def sharpest(obj): return worst +def crown_plate(crown, flare=0.06, drop=0.07, dome=0.03): + """The cage of a plate as the mech experiments block one, facing -y: the crown ring with its sides creased, a skirt + ring flared out of it and dropped back, one centre vertex domed, every ring corner pinned: 2N + 1 vertices.""" + P = np.array(crown, dtype=float) + N = len(P) + normal = np.cross(P, np.roll(P, -1, axis=0)).sum(axis=0) + if normal[1] > 0: + P, normal = P[::-1].copy(), -normal + normal, centre = normal / np.linalg.norm(normal), P.mean(axis=0) + out = (P - centre) - np.outer((P - centre) @ normal, normal) + skirt = P + flare * out / np.linalg.norm(out, axis=1)[:, None] - drop * normal + return {"verts": np.vstack([P, skirt, centre + dome * normal]).round(5).tolist(), + "faces": [[i, (i + 1) % N, 2 * N] for i in range(N)] + [[N + i, N + (i + 1) % N, (i + 1) % N, i] for i in range(N)], + "creases": [[i, (i + 1) % N, 1.0] for i in range(N)], "corners": [[i, 1.0] for i in range(2 * N)], "poles": [] if N == 4 else [2 * N], "rim": 0.0} + + +def beyond(obj, sheet): + """Metres: how far the furthest vertex of an object, as evaluated, stands outside its cage's bounds along an axis.""" + bm = evaluated(obj) + at = np.array([v.co[:] for v in bm.verts]) + bm.free() + cage = np.array(sheet["verts"]) + return float(max((cage.min(axis=0) - at).max(), (at - cage.max(axis=0)).max(), 0.0)) + + def state(): return {o.name: (sorted(k for k in o.keys() if k.startswith("kit_")), len(o.data.vertices) if o.type == "MESH" else None, [m.name for m in o.modifiers]) for o in bpy.data.objects}, sorted(m.name for m in bpy.data.meshes) @@ -161,6 +197,28 @@ try: [tuple(p.vertices) for p in tent.data.polygons] == [tuple(f) for f in TENT["faces"]] and np.abs(np.array([v.co[:] for v in tent.data.vertices]) - built.V).max() < 1e-6 and json.loads(tent["kit_shell"])["sheet"] == TENT, tent["kit_shell"]) + # --- plain-wall: the Solidify's plain offset --------------------------------------------------------------------------- + section("plain-wall") + strip, hexagon = crown_plate(STRIP), crown_plate(HEXAGON) + receipt, report = send("brokkr_kitbash.shell", object_name="Strip", sheet=json.dumps(strip), thickness=0.04, levels=2, bevel=0.01) + plate = bpy.data.objects.get("Strip") + needle = beyond(plate, strip) / 0.04 + plate.modifiers["Kit Solidify"].use_even_offset = True # W1 + R["readings"].update({"needleThicknesses": needle, "needleThicknessesW1": beyond(plate, strip) / 0.04}) + check(f"plain-wall-no-needle: a plate 0.13 m wide with a wall of 0.04 stands under {NEEDLE} thicknesses beyond its cage's bounds, and over that at even offset", + receipt["status"] == "accepted" and report["cageVerts"] == 9 and needle < NEEDLE < R["readings"]["needleThicknessesW1"], [receipt["message"], R["readings"]]) + receipt, report = send("brokkr_kitbash.shell", object_name="Hexagon", sheet=json.dumps(hexagon), thickness=0.015, levels=2, count_folds=True) + plate = bpy.data.objects.get("Hexagon") + plate.modifiers["Kit Solidify"].use_even_offset = True # W1 + even = sys.modules["brokkr_kitbash"].BROKKR_KITBASH_OT_shell.folded_faces(bpy.context, plate, report["subdividedFaces"]) + R["readings"].update({"foldedPlusOne": report["folded"] + 1, "foldedPlusOneW1": even + 1}) + check(f"plain-wall-folds: a hexagon plate 1.2 m across with a wall of 0.015 folds no inner face of its 168 (the count + 1 under {FOLDS}), and over that at even offset", + receipt["status"] == "accepted" and (report["cageVerts"], report["subdividedFaces"], report["poles"]) == (13, 168, {"6": 1}) and report["folded"] + 1 < FOLDS < even + 1, [receipt["message"], report, even]) + for name in ("Strip", "Hexagon"): + mesh = bpy.data.objects[name].data + bpy.data.objects.remove(bpy.data.objects[name]) + bpy.data.meshes.remove(mesh) + # --- the creases reach the surface ----------------------------------------------------------------------------------- section("free-cage-crisp") crisp = sharpest(tent) diff --git a/surfaces/blender/tests/live/kitbash_cage.result.json b/surfaces/blender/tests/live/kitbash_cage.result.json index 4f40224..236e084 100644 --- a/surfaces/blender/tests/live/kitbash_cage.result.json +++ b/surfaces/blender/tests/live/kitbash_cage.result.json @@ -41,6 +41,16 @@ "ok": true, "detail": null }, + { + "name": "plain-wall-no-needle: a plate 0.13 m wide with a wall of 0.04 stands under 1.77 thicknesses beyond its cage's bounds, and over that at even offset", + "ok": true, + "detail": null + }, + { + "name": "plain-wall-folds: a hexagon plate 1.2 m across with a wall of 0.015 folds no inner face of its 168 (the count + 1 under 4.6), and over that at even offset", + "ok": true, + "detail": null + }, { "name": "the creased ridge stays an edge under subdivision: over 34.0 degrees, and under it with crease_edge cleared", "ok": true, @@ -144,6 +154,10 @@ "costSelf": 0.28, "crispDegrees": 71.0, "crispDegreesK1": 16.0, + "foldedPlusOne": 1.0, + "foldedPlusOneW1": 21.0, + "needleThicknesses": 0.95, + "needleThicknessesW1": 3.3, "openRoundTripPct": 1.7e-05, "openRoundTripPctB1": 7.7, "scoreLiftedHausdorffPct": 3.3, diff --git a/surfaces/blender/tests/live/kitbash_faceted.py b/surfaces/blender/tests/live/kitbash_faceted.py index a7c09ab..122f46e 100644 --- a/surfaces/blender/tests/live/kitbash_faceted.py +++ b/surfaces/blender/tests/live/kitbash_faceted.py @@ -1,5 +1,5 @@ """Live proof, in a background Blender, of brokkr_kitbash.shell through run_intent: a loft of rings becomes a cage whose -crease runs stay crisp under subdivision while the rest stays smooth, a wall of even thickness with a filled rim, a +crease runs stay crisp under subdivision while the rest stays smooth, a wall of plain offset with a filled rim, a mirror, a rebuild in place under cutters and ribs, cut_many and ribs on the shell, and the refusals. Not part of the unittest run: it needs Blender. @@ -78,18 +78,20 @@ SOFT = 12.0 # the surface keeps the cage's corner. Shipped 0 (read as 1e-7, what a float32 mesh is good to); least claimed mutant # 0.15 (S5, boundary_smooth ALL: the corner rounds off); the geometric mean, separation 900 each side. CORNER = 1.6e-4 -# The wall's volume over the designed surface's area times the thickness, less 1, as a magnitude. Shipped 0.027 (a wall -# grown inward loses volume inside the crown's curve); least claimed mutant 0.036 (S6, the Solidify above the -# Subdivision: the wall's own edges are rounded off); the geometric mean, a total separation of 1.34. -SOLID = 0.0313 +# The wall's volume over the designed surface's area times the thickness, less 1, as a magnitude. Shipped 0.028 (a wall +# grown inward loses volume inside the crown's curve, and a plain offset is thinner behind the creased shoulder); least +# claimed mutant 0.071 (S6, the Solidify above the Subdivision: the wall's own edges are rounded off); the geometric +# mean, separation 1.58 each side. +SOLID = 0.0447 # Metres between the thickness and the distance from a vertex of the wall's inner face to the designed surface. Shipped -# 0.0001 (a float32 mesh under three levels of subdivision); least claimed mutant 0.024 (S6: the inner face is subdivided again and pulls in); the geometric mean, separation 15 each side. -EVEN = 1.5e-3 -# Metres: the thickness at which the wedge of shell-fold folds, (W / 2^levels) / tan(phi) of its narrower facet, as +# 0.0061 (a plain offset behind the creased shoulder: the wall is 0.0539 there, the thickness x cos(phi)); least claimed +# mutant 0.024 (S6: the inner face is subdivided again and pulls in); the geometric mean, separation 1.99 each side. +WALL_OFF = 0.0122 +# Metres: the thickness at which the wedge of shell-fold folds, (W / 2^levels) / sin(phi) of its narrower facet, as # measured on flat facets (docs/kitbash.md, Thickness at a crease). The wall is built at FOLD / FOLD_STEP (no inner # face folded) and at FOLD x FOLD_STEP (some folded); FOLD_STEP is the 1.2 separation the margin rule asks on each # side of the onset. The counts themselves are exact: count_folds is held to this script's own count, face for face. -FOLD, FOLD_STEP = 0.075, 1.2 +FOLD, FOLD_STEP = 0.106, 1.2 def check(name, ok, detail=None): @@ -220,9 +222,9 @@ try: report["thickness"], report["offset"], report["children"]) == ("Pauldron", False, 6, 6, 25, 25, 0, 1600, 3, 0.06, -1.0, []) and report["facing"][2] > 0.5 and abs(np.linalg.norm(report["facing"]) - 1.0) < 1e-5, report) smooth, wall = pauldron.modifiers.get("Kit Subsurf"), pauldron.modifiers.get("Kit Solidify") - check("the stack is Kit Subsurf, Kit Solidify, Kit Bevel: creases used, corners preserved, an even wall inward with its rim filled", + check("the stack is Kit Subsurf, Kit Solidify, Kit Bevel: creases used, corners preserved, a wall of plain offset inward with its rim filled", stack(pauldron) == ["Kit Subsurf", "Kit Solidify", "Kit Bevel"] and (smooth.levels, smooth.render_levels, smooth.use_creases, smooth.boundary_smooth) == (3, 3, True, "PRESERVE_CORNERS") - and (wall.use_even_offset, wall.use_rim, wall.offset) == (True, True, -1.0) and abs(wall.thickness - WALL) < 1e-7 and abs(pauldron.modifiers["Kit Bevel"].width - 0.004) < 1e-7, + and (wall.use_even_offset, wall.use_rim, wall.offset) == (False, True, -1.0) and abs(wall.thickness - WALL) < 1e-7 and abs(pauldron.modifiers["Kit Bevel"].width - 0.004) < 1e-7, stack(pauldron)) # W1 dies here: the mesh's edges are not in the order core.sheet lists its creases, so the weights must be looked up by pair expected = {tuple(pair): round(weight, 6) for pair, weight in zip(built.creases.tolist(), built.weights.tolist())} @@ -256,7 +258,7 @@ try: # --- shell-fold: count_folds, against this script's own count on the evaluated wall ------------------------------------------- section("shell-fold") - # a ridge of two flat facets 0.3 and 1.0 wide, each tilted 45 degrees, full crease, levels 2: the narrower facet binds, (0.3 / 4) / tan 45 = 0.075 + # a ridge of two flat facets 0.3 and 1.0 wide, each tilted 45 degrees, full crease, levels 2: the narrower facet binds, (0.3 / 4) / sin 45 = 0.106 wedge = {"rings": [[[-1.0 * math.sqrt(0.5), y, -1.0 * math.sqrt(0.5)], [0.0, y, 0.0], [0.3 * math.sqrt(0.5), y, -0.3 * math.sqrt(0.5)]] for y in (0.0, 0.5, 1.0)], "creases": [{"column": 1, "from": 0, "to": 2, "weight": 1.0}]} @@ -290,7 +292,7 @@ try: seeded = {f"{loft['seed']} offset {loft['offset']:g}": folded(f"Loft{loft['seed']}", loft["sheet"], loft["thickness"], offset=loft["offset"], levels=loft["levels"], count_folds=True) for loft in lofts} held = {f"{loft['seed']} offset {loft['offset']:g}": folded(f"Held{loft['seed']}", loft["sheet"], loft["holds"], offset=loft["offset"], levels=loft["levels"], count_folds=True) for loft in lofts if loft["holds"]} R["folds"] = {"seeded": seeded, "held": held} - check("shell-fold: on seeded lofts whose walls fold under any figure of the cage, at offsets -1, 0 and 1, count_folds counts the faces this script counts, and none at a thickness the wall holds", + check("shell-fold: on seeded lofts, at offsets -1, 0 and 1, count_folds counts the faces this script counts at a thickness the wall folds at, and none at one it holds", len(seeded) == 3 and all(told == own > 0 for told, own in seeded.values()) and held and all(pair == [0, 0] for pair in held.values()), [seeded, held]) for name in ["FoldUnder", "FoldOver", "FoldUnasked", "FoldOut"] + [f"{kind}{loft['seed']}" for loft in lofts for kind in ("Loft", "Held")]: if name in bpy.data.objects: @@ -306,10 +308,10 @@ try: inner = [v.co for v in whole.verts if all(outer.find_nearest(f.calc_center_median())[3] > WALL / 2 for f in v.link_faces)] reading("solid", abs(whole.calc_volume(signed=True) / (area * WALL) - 1.0)) for co in inner: - reading("even", abs(outer.find_nearest(co)[3] - WALL)) - check("shell-solid: the plate is a closed wall of even thickness behind the designed surface, its rim filled", + reading("wallOff", abs(outer.find_nearest(co)[3] - WALL)) + check("shell-solid: the plate is a closed wall behind the designed surface, its thickness off it but for the creased shoulder's cosine, its rim filled", sum(1 for e in whole.edges if not e.is_manifold) == 0 and whole.calc_volume(signed=True) > 0 and len(whole.faces) == 2 * 1600 + 4 * 40 and len(inner) > 0.9 * len(designed.verts) - and R["readings"]["solid"] < SOLID and R["readings"]["even"] < EVEN, [R["readings"], len(whole.faces), len(inner), len(designed.verts)]) + and R["readings"]["solid"] < SOLID and R["readings"]["wallOff"] < WALL_OFF, [R["readings"], len(whole.faces), len(inner), len(designed.verts)]) whole.free() # a mirrored breast sheet: symmetric as evaluated diff --git a/surfaces/blender/tests/live/kitbash_faceted.result.json b/surfaces/blender/tests/live/kitbash_faceted.result.json index 14af0bd..8ae3dc9 100644 --- a/surfaces/blender/tests/live/kitbash_faceted.result.json +++ b/surfaces/blender/tests/live/kitbash_faceted.result.json @@ -12,7 +12,7 @@ "detail": null }, { - "name": "the stack is Kit Subsurf, Kit Solidify, Kit Bevel: creases used, corners preserved, an even wall inward with its rim filled", + "name": "the stack is Kit Subsurf, Kit Solidify, Kit Bevel: creases used, corners preserved, a wall of plain offset inward with its rim filled", "ok": true, "detail": null }, @@ -47,12 +47,12 @@ "detail": null }, { - "name": "shell-fold: on seeded lofts whose walls fold under any figure of the cage, at offsets -1, 0 and 1, count_folds counts the faces this script counts, and none at a thickness the wall holds", + "name": "shell-fold: on seeded lofts, at offsets -1, 0 and 1, count_folds counts the faces this script counts at a thickness the wall folds at, and none at one it holds", "ok": true, "detail": null }, { - "name": "shell-solid: the plate is a closed wall of even thickness behind the designed surface, its rim filled", + "name": "shell-solid: the plate is a closed wall behind the designed surface, its thickness off it but for the creased shoulder's cosine, its rim filled", "ok": true, "detail": null }, @@ -176,32 +176,36 @@ "readings": { "corner": 1.8e-07, "crisp": 52.0, - "even": 0.0001, "foldOver": 8.0, "foldUnder": 0.0, "ribsAcrossTheCrease": 1.0, "soft": 5.8, - "solid": 0.027 + "solid": 0.028, + "wallOff": 0.0061 }, "folds": { "seeded": { "5185 offset -1": [ - 2, - 2 + 1, + 1 ], "5101 offset 0": [ - 13, - 13 + 9, + 9 ], "5196 offset 1": [ - 4, - 4 + 1, + 1 ] }, "held": { "5185 offset -1": [ 0, 0 + ], + "5196 offset 1": [ + 0, + 0 ] } },