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/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_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 ] } },