plate.inset2d: half-planes where an edge runs backwards; a sharp corner held only where that is sound; a reflex outline refused; the merge restart held

Soul s1 on cut plate-inset-edge-event:
- clamped-event-bolts-off-plate: the forwards test reads where the lines cross, not the corners held at MITER; an
  edge running backwards gives the outline clipped by every edge's half-plane, so no corner leaves the outline.
  Blade plates (14 to 32 degrees) and 3,000 drawn rings hold it.
- nonconvex-thin-tab-erases-ring: an outline that is not convex with an edge running backwards is refused at
  slab.outline (NotConvex); the oracle test holds the 6 raptor calls c clear of every edge.
- merge-restart-unpinned: three near heads across the ring start are one.
- cut-hard-plate-action.s1.live-test-bolts-literal-pr46: tests/live/kitbash_plates.py reads the bolt polygon count
  off plate.build.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
This commit is contained in:
Meta Vens 2026-12-03 16:51:34 +01:00
commit 555b6124fa
4 changed files with 179 additions and 52 deletions

View file

@ -48,6 +48,7 @@ TIE = 1e-9 # areas (m2) and lengths (m) closer than this are equal: th
OUTER = 0.97 # clad facets "outer": the facet's normal on the face's normal is over this
SHARE = (0.36, 0.64) # where a split panel's cut falls along the facet's longest edge
MITER = 0.3 # an inset corner moves at most c / MITER
REFLEX = 1e-6 # an outline corner turning right by more than this (the sine) makes the outline not convex
PANEL_MIN = (0.25, 0.02) # a panel under this share of its facet, or under this many m2, is not made
SINK, CHAMFER = 0.02, 0.02 # a panel starts this far under its facet; its far rim is chamfered this much
BOLT = 0.028
@ -59,6 +60,10 @@ class PlateError(ValueError):
"""The plate table breaks a rule of the format, or a row bounds no solid; the message names the path."""
class NotConvex(PlateError):
"""inset2d met an edge running backwards on an outline that is not convex: half-planes do not bound that one."""
# --- reading the table ----------------------------------------------------------------------------------------------
def _number(value: Any, path: str, low: float | None = None, high: float | None = None) -> float:
if not core.finite(value):
@ -339,35 +344,37 @@ def plane_basis(normal, up=(0.0, 0.0, 1.0), right=None, path: str = "plane"):
def inset2d(ring, c: float) -> np.ndarray:
"""A convex counter-clockwise outline moved in by c on every edge; a sharp corner moves at most c / MITER. An
edge the move leaves running backwards (or no longer than TIE) is dropped, the shortest first, and its two
neighbours meet where their own lines moved in by c cross. Empty, shape (0, 2), when nothing is left: under
three edges, or two neighbours that never meet."""
"""A counter-clockwise outline moved in by c on every edge, and it stands inside the outline. Each corner moves
along its miter to where its two edges' lines, moved in by c, cross. Where every edge still runs forwards
(longer than TIE) those corners are the answer, a sharp one held to c / MITER from where it was unless that
turns the ring the other way at some corner. Otherwise a convex outline gives what its edges' half-planes, each
moved in by c, leave of it, sharp corners and all: empty, shape (0, 2), when that is nothing. An outline that is
not convex is refused there: NotConvex, naming the first point whose edge ran backwards; a slab's row adds its
path."""
ring = np.asarray(ring, dtype=np.float64)
count = len(ring)
ways = [(ring[(k + 1) % count] - ring[k]) / np.linalg.norm(ring[(k + 1) % count] - ring[k]) for k in range(count)]
lefts = [np.array([-e[1], e[0]]) for e in ways]
out = np.empty_like(ring)
turn = lambda into, away: float(into[0] * away[1] - into[1] * away[0]) # noqa: E731
met, out = np.empty_like(ring), np.empty_like(ring)
for i in range(count):
n0 = lefts[i - 1]
miter = n0 + lefts[i]
length = np.linalg.norm(miter)
miter = miter / length if length > 0 else n0
met[i] = ring[i] + miter * (c / max(float(miter @ n0), 1e-12))
out[i] = ring[i] + miter * (c / max(float(miter @ n0), MITER))
live, pts = list(range(count)), list(out) # pts[i] starts edge live[i]
while True:
m = len(live)
runs = [float((pts[(i + 1) % m] - pts[i]) @ ways[live[i]]) for i in range(m)]
i = min(range(m), key=runs.__getitem__)
if runs[i] > TIE:
return out if m == count else np.array(pts)
a, b = live[i - 1], live[(i + 1) % m]
cross = ways[a][0] * ways[b][1] - ways[a][1] * ways[b][0]
if m <= 3 or abs(cross) < 1e-12:
return np.zeros((0, 2))
start = ring[b] + lefts[b] * c - ring[a] - lefts[a] * c
pts[(i + 1) % m] = ring[a] + lefts[a] * c + ways[a] * ((start[0] * ways[b][1] - start[1] * ways[b][0]) / cross)
del pts[i], live[i]
back = [k for k in range(count) if float((met[(k + 1) % count] - met[k]) @ ways[k]) <= TIE]
if not back and (np.array_equal(met, out) or all(
turn(out[k] - out[k - 1], out[(k + 1) % count] - out[k]) * turn(ways[k - 1], ways[k]) >= 0 for k in range(count))):
return out
if any(turn(ways[k - 1], ways[k]) < -REFLEX for k in range(count)):
raise NotConvex(f"the outline is not convex and, moved in {c}, " + (f"its edge from point {back[0]} runs backwards" if back else "a sharp corner turns it the other way"))
left = list(ring)
for k in range(count):
left = clip(left, ring[k] + lefts[k] * c, -lefts[k])
left = [p for k, p in enumerate(left) if np.linalg.norm(p - left[k - 1]) > TIE]
return np.array(left) if len(left) > 2 else np.zeros((0, 2))
def slab_points(origin, a, b, n, outline, thick: float, taper: float, back: float, gap: float) -> np.ndarray:
@ -461,13 +468,17 @@ def _row_points(row: dict, path: str):
origin = np.array(slab["at"])
a, b, n = plane_basis(slab["normal"], slab["up"], slab.get("right"), f"{at}.normal")
ring = np.array(outline_points(slab["outline"]), dtype=np.float64)
_check_ring(ring, f"{at}.{'corners' if 'corners' in slab else 'outline'}")
drawn = inset2d(ring if _area2(ring) > 0 else ring[::-1], slab["gap"]) if slab["gap"] else ring
if slab["gap"] and _area2(drawn) <= 0:
raise PlateError(f"{at}.gap: {slab['gap']} leaves nothing of the outline")
if slab["taper"] and 2 * slab["taper"] >= _width(drawn):
raise PlateError(f"{at}.taper: {slab['taper']} is half the outline's least width ({_width(drawn):.4f}) or more")
points = slab_points(origin, a, b, n, ring, slab["thick"], slab["taper"], slab["back"], slab["gap"])
key = f"{at}.{'corners' if 'corners' in slab else 'outline'}"
_check_ring(ring, key)
try:
drawn = inset2d(ring if _area2(ring) > 0 else ring[::-1], slab["gap"]) if slab["gap"] else ring
if slab["gap"] and _area2(drawn) <= 0:
raise PlateError(f"{at}.gap: {slab['gap']} leaves nothing of the outline")
if slab["taper"] and 2 * slab["taper"] >= _width(drawn):
raise PlateError(f"{at}.taper: {slab['taper']} is half the outline's least width ({_width(drawn):.4f}) or more")
points = slab_points(origin, a, b, n, ring, slab["thick"], slab["taper"], slab["back"], slab["gap"])
except NotConvex as error:
raise PlateError(f"{key}: {error}") from None
face = (origin, a, b, n)
elif "sections" in row:
points = section_points(row["sections"])

View file

@ -1055,11 +1055,16 @@ that ring has no bolts, and bolts whose centres would stand under 2 `bolt_r` apa
(neighbours in ring order, the first such pair first, until none is left).
One inset, `inset2d`, makes every such ring: a slab's `gap` and `taper`, a panel's outline, its rim and its bolt
ring. It moves each corner along its miter (a sharp corner at most the distance / 0.3). An edge that move leaves
running backwards, its two ends passed over each other, is dropped, the shortest first, and its two neighbours
meet where their own lines moved in cross; under three edges, or two neighbours that never meet, nothing is left
and the ring is empty. For a convex outline with no corner at the 0.3 limit that is exactly what stands the
distance inside every edge. A ring no edge of which runs backwards is the corner move alone, to the byte.
ring. What it returns stands inside the outline. It moves each corner along its miter to where its two edges'
lines, moved in, cross. Where every edge then still runs forwards, those corners are the ring, a sharp one held to
the distance / 0.3 from where it was (unless that would turn the ring the other way at some corner): the corner
move alone, to the byte. Where an edge runs backwards, its two ends passed over each other, a convex outline
gives what its edges' half-planes, each moved in, leave of it: the edges with no room are gone, the sharp corners
stand where the lines cross, and where nothing is left the ring is empty. So a sharp corner jumps inward, from
the 0.3 limit to the crossing, at the distance where the ring first loses an edge. A slab's outline need not be
convex: with every edge running forwards it is moved corner by corner; with one running backwards `check` refuses
the row at `slab.outline` (or `slab.corners`), naming the first point whose edge did, because half-planes do not
bound such an outline.
### Anchors
@ -1116,9 +1121,12 @@ The branches' inset has no edge event, so 31 of the 126 are held to another bolt
others lose one to four to a ring with no room, a dropped edge or heads that would overlap. Two of them, bastion's `Hull.Cheek.R`
and paladin's `Thigh.Outer`, have a panel whose outline dropped a corner, and that panel's vertices are held to
no truth. What holds every ring instead: every `inset2d` call the three fixtures make at both sides (812) stands
inside its outline, and the 782 with no corner at the miter limit equal, within 1e-12 m, the outline's half-planes
moved in and clipped (37 of them an edge or more short, 22 empty); and no panel ring or bolt ring of any plate at
either side turns right or crosses, and no two bolt heads of a panel overlap.
inside its outline. The 6 on a slab outline that is not convex are the corner move, every corner the distance
clear of every edge; 24 hold a sharp corner at the 0.3 limit with every edge running forwards; the other 782
equal, within 1e-12 m, the outline's half-planes moved in and clipped (37 of them an edge or more short, 22
empty). 3,000 drawn convex rings are held the same way, and every bolt of 104 blade plates (tips of 14 to 32
degrees) stands whole on its plate. No panel ring or bolt ring of any plate at either side turns right or
crosses, and no two bolt heads of a panel overlap.
The same test builds the three fixtures to one sha256 of every coordinate rounded to 1e-9 m and every face,
pinned from Starfire (Windows 11, numpy 2.5.4) and Yggdrasil (Debian 13, numpy 2.2.4 on the system LAPACK). The

View file

@ -275,14 +275,14 @@ try:
check("plates on the thigh are accepted and none is a rebuild", receipt["status"] == "accepted" and [row["rebuilt"] for row in report["plates"]] == [False], [receipt["status"], receipt["message"]])
R["reports"]["thigh"] = report
bpy.context.view_layer.update()
proven("a plate on the thigh, the frame the host's", THIGH, 1, "Thigh.", thigh, world(thigh), report)
_, thigh_built = proven("a plate on the thigh, the frame the host's", THIGH, 1, "Thigh.", thigh, world(thigh), report)
receipt, report = send("brokkr_kitbash.plates", host="Shin", prefix="Shin.", table=json.dumps(SHIN))
bpy.context.view_layer.update()
shin_table, shin_built = proven("a plate on the shin, under the pin", SHIN, 1, "Shin.", shin, world(shin), report)
guard = bpy.data.objects["Thigh.Guard"]
check("a plate with a panel and its bolts has two fit children and two anchors, and the panel's child alone a bevel",
sorted(c.name for c in guard.children) == ["Thigh.Guard.fit.gunmetal", "Thigh.Guard.fit.olive_light", "Thigh.Guard.mark.num", "Thigh.Guard.port.feed"]
and len(bpy.data.objects["Thigh.Guard.fit.gunmetal"].data.polygons) == 8 * 8 and bevel(bpy.data.objects["Shin.Guard.fit.olive_light"]) == (0.009, 20.0, 1, "ANGLE")
and len(bpy.data.objects["Thigh.Guard.fit.gunmetal"].data.polygons) == len(thigh_built[0]["bolts"][1]) > 0 and bevel(bpy.data.objects["Shin.Guard.fit.olive_light"]) == (0.009, 20.0, 1, "ANGLE")
and len(bpy.data.objects) == count + 10, [sorted(c.name for c in guard.children), len(bpy.data.objects["Thigh.Guard.fit.gunmetal"].data.polygons), len(bpy.data.objects) - count])
_, joints_after = send("brokkr_kitbash.joints", object_name="Thigh")
check("roll-carries: joints lists the same rows with the plates as without", joints_before is not None and joints_after == joints_before, joints_after)

View file

@ -15,6 +15,7 @@ import importlib
import inspect
import json
import math
import random
import sys
import types
import unittest
@ -137,6 +138,29 @@ def half_planes(ring, c):
return np.array(poly)
def clear(points, ring):
"""How far the nearest edge of a ring (the segment, not its line) stands from each point."""
ring, points = np.asarray(ring, dtype=np.float64), np.asarray(points, dtype=np.float64)
a, edge = ring[None, :, :], (np.roll(ring, -1, axis=0) - ring)[None, :, :]
along = np.clip(((points[:, None, :] - a) * edge).sum(axis=2) / (edge * edge).sum(axis=2), 0, 1)
return np.linalg.norm(points[:, None, :] - a - edge * along[:, :, None], axis=2).min(axis=1)
def within(point, ring):
"""Whether a point stands inside a ring, convex or not: a ray to +x crosses its edges an odd number of times."""
a, b = np.asarray(ring, dtype=np.float64), np.roll(np.asarray(ring, dtype=np.float64), -1, axis=0)
over = (a[:, 1] > point[1]) != (b[:, 1] > point[1])
return bool(np.sum(a[over, 0] + (point[1] - a[over, 1]) * (b[over, 0] - a[over, 0]) / (b[over, 1] - a[over, 1]) > point[0]) % 2)
def blade(tip, length, rear, bolt_r=0.03):
"""A blade plate 0.4 thick, its tip at the origin `tip` degrees wide, `rear` across its far end, clad on top."""
half = math.tan(math.radians(tip / 2)) * 0.7 * length
top = [(0, 0), (0.7 * length, -half), (length, -rear / 2), (length, rear / 2), (0.7 * length, half)]
clad = {"mat": "c", "facets": [{"n": [0, 0, 1], "cos": 0.6}], "min_area": 0.01, "lifts": [0.045, 0.075], "inset": 0.11, "gap": 0.05, "split": 99, "seed": 1, "bolt_r": bolt_r}
return doc(row("Fin", clad=clad, points=[[x, y, z] for z in (0, 0.4) for x, y in top]))
def turns(ring):
"""Each corner's turn (the cross product of the unit edges into and out of it): over 0 is a left turn."""
ring = np.asarray(ring, dtype=np.float64)
@ -164,9 +188,10 @@ def sides(mech):
@unittest.skipIf(np is None, "numpy is not installed")
class InsetTests(unittest.TestCase):
"""plate.inset2d, the one inset of every ring. Kills: the edge event removed; the vanish test at three edges
made two; the shortest-first pick made the first edge found (the clamped sliver alone: without a clamped corner
every order drops the same edges)."""
"""plate.inset2d, the one inset of every ring. Kills: the half-planes left out (the corner move returned whatever
its edges do); the forwards test read off the corners held at MITER and not off where the lines cross; the turn
test of the held corners removed; a ring that is not convex given to the half-planes; a right turn of a rounding
read as not convex; a half-plane left out; the ring of under three corners or of corners TIE apart returned."""
def test_a_short_edge_is_dropped_and_its_neighbours_meet(self):
ring = [[0, 0], [4, 0], [4, 3], [2.1, 4], [1.9, 4]] # the top edge is 0.2 long
@ -192,11 +217,51 @@ class InsetTests(unittest.TestCase):
self.assertEqual(plate.inset2d(ring, c).tobytes(), corner_move(ring, c)[0].tobytes())
self.assertTrue(corner_move([[0, 0], [5, 0], [0, 1]], 0.1)[1]) # its sharp corner is clamped
def test_the_shortest_edge_goes_first(self):
sliver = [[11, 1], [12, 1], [6, 3], [4, 3], [6, 2]] # two corners clamped, three edges run backwards
made = plate.inset2d(sliver, 0.5)
self.assertLess(apart2(made, np.array([[6.516380, 2.300827], [5.918861, 2.5], [5.622082, 2.617078]])), 1e-6)
self.assertGreater(float(depths(made, sliver).min()), 0)
def test_a_sharp_corner_held_back_is_no_way_out_of_the_outline(self):
sliver = [[11, 1], [12, 1], [6, 3], [4, 3], [6, 2]] # two corners sharp: an edge goes at 0.3, all of it at 0.5
kite = [[4, 1], [7, 0], [3, 2], [0, 3]] # held at MITER every edge runs forwards, and two corners stand outside
wedge = [[0, 1], [6, 1], [7, 3], [3, 2]] # every edge runs forwards where the lines cross; held, the ring turns right
for ring, c, corners in ((sliver, 0.3, 4), (sliver, 0.5, 0), (kite, 0.5, 0), (wedge, 0.5, 4)):
made = plate.inset2d(ring, c)
self.assertEqual(len(made), corners)
self.assertLess(apart2(made, half_planes(ring, c)), 1e-12)
self.assertLess(float(depths(corner_move(kite, 0.5)[0], kite).min()), -0.05)
self.assertLess(float(turns(corner_move(wedge, 0.5)[0]).min()), 0)
def test_every_inset_of_a_convex_ring_stands_inside_it(self):
draw, rings_, held, dropped, empty = random.Random(7), 0, 0, 0, 0
while rings_ < 3000:
at = sorted(draw.uniform(0, 2 * math.pi) for _ in range(draw.choice((3, 4, 5, 6, 7))))
wide, tall = draw.uniform(0.15, 2.0), draw.uniform(0.02, 0.5)
ring = np.array([[wide * math.cos(u), tall * math.sin(u)] for u in at])
if float(np.linalg.norm(np.roll(ring, -1, axis=0) - ring, axis=1).min()) < 0.005 or float(turns(ring).min()) < 1e-4:
continue
c, rings_ = draw.choice((0.01, 0.03, 0.1, 0.25)), rings_ + 1
made, (moved, clamped) = plate.inset2d(ring, c), corner_move(ring, c)
if made.tobytes() == moved.tobytes():
held += clamped
self.assertGreater(float(depths(made, ring).min()), 0)
self.assertGreater(float(turns(made).min()), 0)
self.assertLess(apart2(made, half_planes(ring, c)), 1e-12 if not clamped else math.inf)
else:
dropped, empty = dropped + (len(made) > 0), empty + (not len(made))
self.assertLess(apart2(made, half_planes(ring, c)), 1e-12)
self.assertEqual((held, dropped, empty), HELD)
def test_an_outline_that_is_not_convex_is_moved_or_refused(self):
tab = [[0, 0], [4, 0], [4, 2], [2.2, 2], [2.2, 2.8], [1.8, 2.8], [1.8, 2], [0, 2]] # a tab 0.4 wide on a 4 by 2 body
for c in (0.05, 0.15):
made = plate.inset2d(tab, c)
self.assertEqual(made.tobytes(), corner_move(tab, c)[0].tobytes())
self.assertGreater(float(clear(made, tab).min()), c - 1e-12)
self.assertTrue(all(within(p, tab) for p in made) and not plate._crosses(made))
with self.assertRaises(plate.NotConvex) as caught:
plate.inset2d(tab, 0.25)
self.assertIn("its edge from point 4 runs backwards", str(caught.exception))
straight = [[0, 0], [3 * 0.3, 3 * 0.3 * 0.3], [3, 3 * 0.3], [3, 3 * 0.3 + 0.2], [0, 1]] # its second point is on a straight run
self.assertTrue(-1e-12 < float(turns(straight)[1]) < 0) # and turns right by a rounding: that is no outline to refuse
self.assertEqual(len(plate.inset2d(straight, 0.15)), 3)
self.assertLess(apart2(plate.inset2d(straight, 0.15), half_planes(straight, 0.15)), 1e-12)
def test_every_inset_of_the_fixtures_is_what_the_half_planes_leave(self):
inset, calls = plate.inset2d, []
@ -208,18 +273,26 @@ class InsetTests(unittest.TestCase):
for mech in ("bastion", "paladin", "raptor"):
for side in (1, -1):
plate.build(fixture(mech)["table"], side)
held = dropped = empty = 0
reflex = held = dropped = empty = 0
for ring, c, made in calls:
if float(turns(ring).min()) <= 0: # a slab's outline need not be convex: no edge of those runs backwards
self.assertEqual(made.tobytes(), corner_move(ring, c)[0].tobytes())
moved, clamped = corner_move(ring, c)
if float(turns(ring).min()) <= 0: # a slab's outline need not be convex: every corner moved, c clear of every edge
reflex += 1
self.assertEqual(made.tobytes(), moved.tobytes())
self.assertFalse(clamped)
self.assertGreater(float(clear(made, ring).min()), c - 1e-12)
self.assertTrue(all(within(p, ring) for p in made) and not plate._crosses(made))
self.assertGreater(float((turns(made) * turns(ring)).min()), 0)
continue
if len(made):
self.assertGreater(float(depths(made, ring).min()), 0) # clamped or not, it stands inside its outline
self.assertGreater(float(depths(made, ring).min()), 0) # it stands inside its outline
self.assertGreater(float(turns(made).min()), 0)
if not corner_move(ring, c)[1]:
self.assertLess(apart2(made, half_planes(ring, c)), 1e-12)
held, dropped, empty = held + 1, dropped + (0 < len(made) < len(ring)), empty + (not len(made))
self.assertEqual((len(calls), held, dropped, empty), (812, 782, 37, 22))
if clamped and made.tobytes() == moved.tobytes():
held += 1 # a sharp corner held at MITER: inside, turning left, not the half-planes
continue
self.assertLess(apart2(made, half_planes(ring, c)), 1e-12)
dropped, empty = dropped + (0 < len(made) < len(ring)), empty + (not len(made))
self.assertEqual((len(calls), reflex, held, dropped, empty), (812, 6, 24, 37, 22))
@unittest.skipIf(np is None, "numpy is not installed")
@ -293,6 +366,12 @@ class CheckTests(unittest.TestCase):
def test_outline_of_zero_area(self):
self.refused(doc(row(slab=dict(SLAB, outline=[[0, 0], [1, 0], [2, 0]]))), "plates[0].slab.outline: the outline has zero area")
def test_an_outline_not_convex_that_the_gap_or_the_taper_collapses(self):
tab = [[0, 0], [4, 0], [4, 2], [2.2, 2], [2.2, 2.8], [1.8, 2.8], [1.8, 2], [0, 2]]
self.refused(doc(row(slab=dict(SLAB, outline=tab, gap=0.25))), "plates[0].slab.outline: the outline is not convex and, moved in 0.25, its edge from point 4 runs backwards")
self.refused(doc(row(slab=dict(SLAB, outline=tab, gap=0.15, taper=0.06))), "plates[0].slab.outline: the outline is not convex and, moved in 0.06,")
plate.check(doc(row(slab=dict(SLAB, outline=tab, gap=0.15))))
def test_slab_ranges(self):
for key, low, high in (("thick", 0.0005, 2.5), ("taper", -0.01, 0.6), ("back", 0.05, 1.6), ("gap", -0.01, 0.6)):
for value in (low, high):
@ -547,6 +626,34 @@ class CladTests(unittest.TestCase):
self.assertTrue(plate.panel(panels, bolts, thin, np.array([0.0, 0.0, 1.0]), 0.04, 0.0, 0.028))
self.assertEqual((len(panels.done()[0]), len(bolts.done()[0])), (12, 0))
def test_three_near_heads_across_the_ring_start_are_one(self):
"""Kills: the merge going on from the pair before in place of the first pair (it leaves two heads 1.9 r apart)."""
r = 0.03
heads = np.array([[1.9, 0.9], [1.5, 40], [-18, 40], [-18, 9], [0, 0], [1.9, -0.9]]) * r # the last and the first 1.8 r apart, their middle 1.9 r from the one before
outline = corner_move(heads, -(0.05 + 3.2 * r))[0]
self.assertLess(apart2(plate.inset2d(plate.inset2d(outline, 0.05), 3.2 * r), heads), 1e-12)
bolts = plate._Mesh()
self.assertTrue(plate.panel(plate._Mesh(), bolts, [np.array([x, y, 0.0]) for x, y in outline], np.array([0.0, 0.0, 1.0]), 0.04, 0.05, r))
made = bolts.done()[0].reshape(-1, 12, 3).mean(axis=1)[:, :2]
self.assertLess(apart2(made, np.array([[1.5, 40], [-18, 40], [-18, 9], [0.95, 0]]) * r), 1e-12)
def test_every_bolt_of_a_blade_plate_stands_on_it(self):
"""Kills: the half-planes left out (10 of these blades then put a bolt off the plate, the worst 3.3 m)."""
entry = plate.build(blade(20, 1.5, 0.3), 1)[0] # its bolt ring is narrower than the bolts stand in: no ring, no bolts
self.assertEqual((entry["report"]["panels"], entry["report"]["bolts"]), (1, 0))
bolted, least = 0, math.inf
for tip in (14, 16, 18, 20, 22, 25, 28, 32):
for length in (0.8, 1.2, 1.5, 2.0, 3.0):
for rear in (0.1, 0.2, 0.3, 0.4, 0.6):
entry = plate.build(blade(tip, length, rear), 1)[0]
V, faces = entry["solid"]
(top,) = [face for face in faces if all(V[k][2] > 0.3 for k in face)]
if entry["report"]["bolts"]:
bolted += 1
least = min(least, float(depths(entry["bolts"][0].reshape(-1, 12, 3).mean(axis=1)[:, :2], V[top][:, :2]).min()))
self.assertEqual(bolted, 104)
self.assertGreater(least, 0.03) # a head's corners reach bolt_r: every head whole on its facet
def test_a_rim_the_chamfer_leaves_fewer_corners_is_the_outline(self):
mesh, axes = plate._Mesh(), np.eye(3)
plate.prism(mesh, np.zeros(3), *axes, np.array([[0, 0], [1, 0], [1, 1], [0.502, 1.2], [0.498, 1.2], [0, 1]], dtype=float), 0.1, 0.02)
@ -707,6 +814,7 @@ EVENT = {("bastion", 1, "Hull.Cheek.R"): (32, 1), ("bastion", 1, "Hull.Cheek.L")
# 2.5.4) and Yggdrasil (Debian 13, numpy 2.2.4 on the system LAPACK) give this hash; their numbers (every coordinate and anchor matrix
# entry) differ in 2,821 of 30,909 by up to 2.7e-15 m and in no face. QUANTUM is TIE: 3.7e5 times that, and 1e3 under the least difference KNOWN holds (1.06e-6 m).
QUANTUM = 1e-9
HELD = (816, 585, 1022) # of 3,000 drawn convex rings: sharp corners held at MITER, rings that lost an edge, rings left empty
HASH = "ee58f30a9492f1a7b0809b92bf46aa5fd01d1e06a6fa40edde15b2842f4afa1e"