Seraph round 8: wrapped legs, deep two-view pauldrons, plated arms, closed torso; flowlines, interior and legs sheets
Thigh plates run tapered to the knee on the operator's leg lines, with cuisses and calf masses round the frame. fit.arch takes a second traced view (the rear) and the rear view's scale. compare.py scores her flow lines (sweep, edge direction) and the dark share inside the outline, hero and rear. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
This commit is contained in:
parent
3b61f637b6
commit
6dbba84296
7 changed files with 469 additions and 90 deletions
|
|
@ -329,6 +329,149 @@ def chest_head_sheet():
|
|||
return out
|
||||
|
||||
|
||||
def carried(points, along, cj, oj):
|
||||
"""A line of the concept's hero view carried onto ours by the skeleton: each point is held by the bone of `along`
|
||||
(joint names) it lies nearest, as a fraction along the bone and an offset across it in bone lengths, and set
|
||||
down the same way by our bone. A line held by three joints that are not a chain (the chest's: both shoulders
|
||||
and the waist) is carried by the affine map of that triangle instead. cj, oj: {joint: (x, y)} in each picture."""
|
||||
P = np.asarray(points, float)
|
||||
if "waist" in along:
|
||||
A = np.array([[*cj[k], 1.0] for k in along])
|
||||
M = np.linalg.solve(A, np.array([oj[k] for k in along], float))
|
||||
return [tuple(q) for q in np.c_[P, np.ones(len(P))] @ M]
|
||||
out = []
|
||||
for p in P:
|
||||
best = None
|
||||
for i, (ka, kb) in enumerate(zip(along, along[1:])):
|
||||
a, b = np.array(cj[ka], float), np.array(cj[kb], float)
|
||||
t = float((p - a) @ (b - a) / ((b - a) @ (b - a)))
|
||||
tc = t if (i == 0 and t < 0) or (i == len(along) - 2 and t > 1) else min(max(t, 0.0), 1.0)
|
||||
d = float(np.hypot(*(p - (a + tc * (b - a)))))
|
||||
if best is None or d < best[0]:
|
||||
n = np.array([-(b - a)[1], (b - a)[0]]) / np.hypot(*(b - a))
|
||||
best = (d, ka, kb, tc, float((p - a - tc * (b - a)) @ n) / np.hypot(*(b - a)))
|
||||
_, ka, kb, t, off = best
|
||||
a, b = np.array(oj[ka], float), np.array(oj[kb], float)
|
||||
n = np.array([-(b - a)[1], (b - a)[0]]) / np.hypot(*(b - a))
|
||||
out.append(tuple(a + t * (b - a) + off * np.hypot(*(b - a)) * n))
|
||||
return out
|
||||
|
||||
|
||||
def flow_sheet(hero):
|
||||
"""<name>_flowlines.png: the operator's markup (her strokes on the concept and on round 7's build) beside this
|
||||
build's hero view with her concept strokes carried onto it by the skeleton. Per line, into <name>_scores.json
|
||||
"flow": sweep (do the two lines run alike, each in its own picture) and edge (do the picture's edges run along
|
||||
the line; ours is the best of small shifts of the carried line across itself, the concept's is beside it)."""
|
||||
sk_file = src / f"{name}_skeleton.json"
|
||||
if "flow" not in spec or not sk_file.exists():
|
||||
return {}
|
||||
flow = spec["flow"]
|
||||
kf, ks = sheet.width / flow["unit"], sheet.width / spec["skeleton"]["unit"]
|
||||
cj = {k: (x * ks, y * ks) for k, (x, y) in spec["skeleton"]["views"]["hero"]["joints"].items()}
|
||||
ov = json.loads(sk_file.read_text(encoding="utf-8"))["views"]["hero"]
|
||||
up = hero.width / ov["size"][0]
|
||||
oj = {k: (x * up, y * up) for k, (x, y) in ov["joints"].items()}
|
||||
sil = Image.open(src / f"{name}_sil_hero.png").split()[-1]
|
||||
fig_o = (sil.getbbox()[3] - sil.getbbox()[1]) * up
|
||||
fig_c = (spec["skeleton"]["views"]["hero"]["ground"] - spec["skeleton"]["views"]["hero"]["top"]) * ks
|
||||
out, lines = {}, []
|
||||
for tag, line in flow["lines"].items():
|
||||
c = [(x * kf, y * kf) for x, y in line["points"]]
|
||||
o = carried(c, line["along"], cj, oj)
|
||||
ec, _ = edge_along(sheet, c, max(3, round(0.012 * fig_c)))
|
||||
half = max(3, round(0.012 * fig_o))
|
||||
tan = np.asarray(o[-1], float) - np.asarray(o[0], float)
|
||||
nor = np.array([-tan[1], tan[0]]) / np.hypot(*tan)
|
||||
eo, shift, tenths = max((edge_along(hero, [tuple(np.asarray(q) + nor * d) for q in o], half) + (d,) for d in np.linspace(-0.025, 0.025, 11) * fig_o), key=lambda r: r[0])[::2] + (None,)
|
||||
eo, tenths = edge_along(hero, [tuple(np.asarray(q) + nor * shift) for q in o], half)
|
||||
out[tag] = {"sweep": round(sweep(c, o), 3), "edge_ours": round(eo, 3), "edge_concept": round(ec, 3), "edge_ours_least_tenth": round(min(tenths), 3)}
|
||||
print(f"FLOW {name} {tag}: sweep {out[tag]['sweep']:.2f}; edges along the line, ours {eo:.2f} (least tenth {min(tenths):.2f}), concept {ec:.2f}")
|
||||
lines.append(o)
|
||||
mean = {k: round(float(np.mean([v[k] for v in out.values()])), 3) for k in ("sweep", "edge_ours", "edge_concept")}
|
||||
print(f"FLOW {name} mean: sweep {mean['sweep']:.2f}, edge ours {mean['edge_ours']:.2f}, concept {mean['edge_concept']:.2f}")
|
||||
out["mean"] = mean
|
||||
markup = Image.open(Path(os.environ["MECH_CONCEPTS"]) / flow["markup"]).convert("RGB")
|
||||
box = sil.getbbox()
|
||||
pad = round(0.04 * fig_o)
|
||||
ours = drawn(hero, lines, max(6, hero.width // 110)).crop((max(0, round(box[0] * up) - pad), max(0, round(box[1] * up) - pad), min(hero.width, round(box[2] * up) + pad), min(hero.height, round(box[3] * up) + pad)))
|
||||
row([label(fit(markup, H), "the operator's markup: the concept's lines, and the same lines as round 7 built them"),
|
||||
label(fit(ours, H), f"this build: her concept lines carried onto it by the skeleton. mean sweep {mean['sweep']:.2f}, edge {mean['edge_ours']:.2f} (concept {mean['edge_concept']:.2f})")], H).save(dst / f"{name}_flowlines.png")
|
||||
return out
|
||||
|
||||
|
||||
def figure(img, mask, n=480):
|
||||
"""A figure cut to its mask's bounds and set n px tall: (luminance, mask as bool)."""
|
||||
box = mask.getbbox()
|
||||
size = (max(1, round((box[2] - box[0]) * n / (box[3] - box[1]))), n)
|
||||
return np.asarray(img.convert("L").crop(box).resize(size, Image.LANCZOS), float), np.asarray(mask.crop(box).resize(size, Image.LANCZOS)) > 127
|
||||
|
||||
|
||||
def interior(c_img, c_mask, o_img, o_mask, cells=40):
|
||||
"""The match inside the outline. Both figures at one height, feet and middles together; each picture's pixels inside
|
||||
its own outline split into dark (frame, joints, deep shadow) and light (armor) at 0.45 of its own lit armor's
|
||||
brightness (the 90th percentile inside the outline); the dark
|
||||
share of each cell of a `cells`-row grid compared where both outlines cover the cell. Returns (agreement: 1 less
|
||||
the mean difference of the cells' dark shares; the concept's dark share; ours; the same three below the middle
|
||||
of the figure, where the legs are; the two dark maps and the common mask, for the sheet)."""
|
||||
(lc, mc), (lo, mo) = figure(c_img, c_mask), figure(o_img, o_mask)
|
||||
w = max(lc.shape[1], lo.shape[1])
|
||||
|
||||
def centred(a, fill):
|
||||
out = np.full((a.shape[0], w), fill, a.dtype)
|
||||
x = (w - a.shape[1]) // 2
|
||||
out[:, x:x + a.shape[1]] = a
|
||||
return out
|
||||
lc, mc, lo, mo = centred(lc, 0.0), centred(mc, False), centred(lo, 0.0), centred(mo, False)
|
||||
dc, do = (lc < 0.45 * np.percentile(lc[mc], 90)) & mc, (lo < 0.45 * np.percentile(lo[mo], 90)) & mo
|
||||
both = mc & mo
|
||||
step = lc.shape[0] // cells
|
||||
|
||||
def score(rows):
|
||||
diffs, sc, so, weight = 0.0, 0.0, 0.0, 0.0
|
||||
for y in range(rows.start, rows.stop - step + 1, step):
|
||||
for x in range(0, w - step + 1, step):
|
||||
cover = both[y:y + step, x:x + step]
|
||||
if cover.mean() > 0.5:
|
||||
a, b = dc[y:y + step, x:x + step][cover].mean(), do[y:y + step, x:x + step][cover].mean()
|
||||
diffs, sc, so, weight = diffs + abs(a - b), sc + a, so + b, weight + 1
|
||||
return 1 - diffs / max(weight, 1), sc / max(weight, 1), so / max(weight, 1)
|
||||
return score(range(0, lc.shape[0])) + score(range(lc.shape[0] // 2, lc.shape[0])) + (dc, do, both, mc, mo)
|
||||
|
||||
|
||||
def dark_map(dark, mask):
|
||||
rgb = np.full(dark.shape + (3,), 255, np.uint8)
|
||||
rgb[mask], rgb[dark] = (176, 170, 140), (30, 30, 30)
|
||||
return Image.fromarray(rgb)
|
||||
|
||||
|
||||
def polygon_mask(points, unit):
|
||||
kk = sheet.width / unit
|
||||
m = Image.new("L", sheet.size, 0)
|
||||
ImageDraw.Draw(m).polygon([(x * kk, y * kk) for x, y in points], fill=255)
|
||||
return m
|
||||
|
||||
|
||||
def interior_sheet(hero, rear):
|
||||
"""<name>_interior.png and <name>_legs.png; the interior scores of the hero and rear views into the scores file."""
|
||||
views = {"hero": (polygon_mask(spec["outline"], spec["unit"]), hero)}
|
||||
if "rear_outline" in spec:
|
||||
views["rear"] = (polygon_mask(spec["rear_outline"]["points"], spec["rear_outline"]["unit"]), rear)
|
||||
out, panels, legs = {}, [], []
|
||||
for view, (c_mask, render) in views.items():
|
||||
o_mask = Image.open(src / f"{name}_sil_{view}.png").split()[-1].point(lambda v: 255 if v > 96 else 0).resize(render.size, Image.LANCZOS)
|
||||
a, sc, so, la, lsc, lso, dc, do, both, mc, mo = interior(sheet, c_mask, render, o_mask)
|
||||
iou = (mc & mo).sum() / max((mc | mo).sum(), 1)
|
||||
out[view] = {"interior": round(a, 3), "dark_concept": round(sc, 3), "dark_ours": round(so, 3), "legs_interior": round(la, 3), "legs_dark_concept": round(lsc, 3), "legs_dark_ours": round(lso, 3), "outline": round(float(iou), 3)}
|
||||
print(f"INTERIOR {name} {view}: agreement {a:.2f}, dark share concept {sc:.2f} ours {so:.2f}; legs {la:.2f}, dark {lsc:.2f} vs {lso:.2f}; outline overlap {iou:.2f}")
|
||||
panels += [label(fit(dark_map(dc, mc), H), f"concept, {view}: dark inside the outline"), label(fit(dark_map(do, mo), H), f"ours: agreement {a:.2f}; dark {sc:.2f} vs {so:.2f}; legs {la:.2f}")]
|
||||
cbox, obox = c_mask.getbbox(), o_mask.getbbox()
|
||||
cut = lambda img, box: img.crop((box[0], box[1] + round(0.44 * (box[3] - box[1])), box[2], box[3])) # noqa: E731 from the hips down
|
||||
legs += [label(fit(cut(sheet, cbox), 1000), f"concept, {view}: the legs"), label(fit(cut(render, obox), 1000), f"ours, {view}: interior {la:.2f}, dark share {lsc:.2f} vs {lso:.2f}")]
|
||||
row(panels, H).save(dst / f"{name}_interior.png")
|
||||
row(legs, 1000).save(dst / f"{name}_legs.png")
|
||||
return out
|
||||
|
||||
|
||||
H = 1100
|
||||
if os.environ.get("MECH_CHEST_ONLY"):
|
||||
chest_head_sheet()
|
||||
|
|
@ -359,6 +502,9 @@ if "icon" in spec:
|
|||
row(panels, H).save(dst / f"{name}_silhouette.png")
|
||||
|
||||
match_sheet(hero)
|
||||
extra = {"chest_lines": chest_head_sheet(), "flow": flow_sheet(hero), "interior": interior_sheet(hero, rear)}
|
||||
scores_path = dst / f"{name}_scores.json"
|
||||
scores_path.write_text(json.dumps({**json.loads(scores_path.read_text(encoding="utf-8")), **extra}, indent=1), encoding="utf-8")
|
||||
|
||||
rows = []
|
||||
for tag, box in spec["joints"].items():
|
||||
|
|
@ -441,7 +587,7 @@ if "skeleton" in spec and sk_path.exists():
|
|||
panels += [label(fit(concept_img, H), f"concept, {view}: marked skeleton"), label(fit(ours_img, H), f"ours, {view}: the build's joints"), text]
|
||||
row(panels, H).save(dst / f"{name}_proportions.png")
|
||||
|
||||
for f in ("vs_concept", "silhouette", "joints", "proportions"):
|
||||
for f in ("vs_concept", "silhouette", "joints", "proportions", "flowlines", "legs", "interior", "chest_head"):
|
||||
p = dst / f"{name}_{f}.png"
|
||||
if p.exists():
|
||||
im = Image.open(p)
|
||||
|
|
|
|||
|
|
@ -1604,6 +1604,76 @@
|
|||
]
|
||||
],
|
||||
"label": "hip bearings as far as the hero view shows them"
|
||||
},
|
||||
"pauldron_rear": {
|
||||
"source": "bench",
|
||||
"crop": [
|
||||
700,
|
||||
20,
|
||||
800,
|
||||
140
|
||||
],
|
||||
"polygons": [
|
||||
[
|
||||
[
|
||||
774,
|
||||
34
|
||||
],
|
||||
[
|
||||
752,
|
||||
40
|
||||
],
|
||||
[
|
||||
738,
|
||||
52
|
||||
],
|
||||
[
|
||||
726,
|
||||
70
|
||||
],
|
||||
[
|
||||
719,
|
||||
90
|
||||
],
|
||||
[
|
||||
716,
|
||||
108
|
||||
],
|
||||
[
|
||||
715,
|
||||
115
|
||||
],
|
||||
[
|
||||
720,
|
||||
122
|
||||
],
|
||||
[
|
||||
740,
|
||||
117
|
||||
],
|
||||
[
|
||||
752,
|
||||
112
|
||||
],
|
||||
[
|
||||
762,
|
||||
100
|
||||
],
|
||||
[
|
||||
778,
|
||||
92
|
||||
],
|
||||
[
|
||||
782,
|
||||
70
|
||||
],
|
||||
[
|
||||
780,
|
||||
48
|
||||
]
|
||||
]
|
||||
],
|
||||
"label": "left pauldron, rear view"
|
||||
}
|
||||
}
|
||||
},
|
||||
|
|
@ -1720,16 +1790,16 @@
|
|||
],
|
||||
"side": [
|
||||
[
|
||||
1.1,
|
||||
-0.5
|
||||
0.97,
|
||||
-0.82
|
||||
],
|
||||
[
|
||||
1.12,
|
||||
-0.15
|
||||
0.97,
|
||||
-0.45
|
||||
],
|
||||
[
|
||||
0.95,
|
||||
0.5
|
||||
0.85,
|
||||
0.45
|
||||
],
|
||||
[
|
||||
0.45,
|
||||
|
|
@ -1740,16 +1810,16 @@
|
|||
1.0
|
||||
],
|
||||
[
|
||||
-0.95,
|
||||
0.5
|
||||
-0.85,
|
||||
0.45
|
||||
],
|
||||
[
|
||||
-1.12,
|
||||
-0.15
|
||||
-0.97,
|
||||
-0.45
|
||||
],
|
||||
[
|
||||
-1.1,
|
||||
-0.5
|
||||
-0.97,
|
||||
-0.82
|
||||
]
|
||||
]
|
||||
},
|
||||
|
|
@ -2034,6 +2104,109 @@
|
|||
0.95
|
||||
]
|
||||
]
|
||||
},
|
||||
"pauldron.cap_rear": {
|
||||
"front": [
|
||||
[
|
||||
774,
|
||||
34
|
||||
],
|
||||
[
|
||||
752,
|
||||
40
|
||||
],
|
||||
[
|
||||
738,
|
||||
52
|
||||
],
|
||||
[
|
||||
726,
|
||||
70
|
||||
],
|
||||
[
|
||||
719,
|
||||
90
|
||||
],
|
||||
[
|
||||
716,
|
||||
108
|
||||
],
|
||||
[
|
||||
715,
|
||||
115
|
||||
],
|
||||
[
|
||||
720,
|
||||
122
|
||||
],
|
||||
[
|
||||
740,
|
||||
117
|
||||
],
|
||||
[
|
||||
752,
|
||||
112
|
||||
],
|
||||
[
|
||||
762,
|
||||
100
|
||||
],
|
||||
[
|
||||
778,
|
||||
92
|
||||
],
|
||||
[
|
||||
782,
|
||||
70
|
||||
],
|
||||
[
|
||||
780,
|
||||
48
|
||||
]
|
||||
],
|
||||
"origin": [
|
||||
781,
|
||||
82
|
||||
],
|
||||
"view": [
|
||||
180,
|
||||
-12
|
||||
],
|
||||
"sheet_view": "rear",
|
||||
"side": [
|
||||
[
|
||||
0.97,
|
||||
-0.82
|
||||
],
|
||||
[
|
||||
0.97,
|
||||
-0.45
|
||||
],
|
||||
[
|
||||
0.85,
|
||||
0.45
|
||||
],
|
||||
[
|
||||
0.45,
|
||||
1.0
|
||||
],
|
||||
[
|
||||
-0.45,
|
||||
1.0
|
||||
],
|
||||
[
|
||||
-0.85,
|
||||
0.45
|
||||
],
|
||||
[
|
||||
-0.97,
|
||||
-0.45
|
||||
],
|
||||
[
|
||||
-0.97,
|
||||
-0.82
|
||||
]
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
|
|
|
|||
|
|
@ -16,7 +16,9 @@ back(). Two fitters use it:
|
|||
the flank the camera's azimuth shows, is the plate's width; the side outline gives its front and its back
|
||||
arch() a cap over a joint: a ring per station fore and aft; the outline's upper and outer edge, sampled where the
|
||||
caller names its corners, is the cap's section at its middle; the side outline lowers and shortens that
|
||||
section toward the cap's two ends
|
||||
section toward the cap's two ends. With a second outline traced on the rear view (`aft`, its own camera)
|
||||
the cap's rear half takes that view's section, and Outline.scaled() brings the hero outline, drawn large
|
||||
where the hero camera stands close, to the rear view's size
|
||||
band() two of the operator's flow lines as the half-width of a plate's centre panel at a view height: where the
|
||||
plate's two crease columns stand
|
||||
Each returns rings of [x, y, z] for a sheet. The match score (compare.py) judges the result at the same camera.
|
||||
|
|
@ -58,6 +60,11 @@ class Outline:
|
|||
cuts = _cuts(self.points, axis, at)
|
||||
return cuts[0], cuts[-1]
|
||||
|
||||
def scaled(self, k):
|
||||
"""The outline k times as large about its origin: a part the hero view draws nearer than the figure's middle
|
||||
is drawn larger than the figure's scale gives; a second, farther view of it says by how much."""
|
||||
return Outline([(u * k, v * k) for u, v in self.points])
|
||||
|
||||
def left(self, v):
|
||||
return self.span(1, v)[0]
|
||||
|
||||
|
|
@ -76,8 +83,9 @@ def load(mech, plate):
|
|||
spec = json.loads((HERE / "concepts.json").read_text(encoding="utf-8"))[mech]
|
||||
hero = spec["skeleton"]["views"]["hero"]
|
||||
doc = spec["outlines"]
|
||||
scale = spec["skeleton"]["height_m"] / (hero["ground"] - hero["top"]) * spec["skeleton"]["unit"] / doc["unit"]
|
||||
o = doc["plates"][plate]
|
||||
hero = spec["skeleton"]["views"][o.get("sheet_view", "hero")] # an outline traced on the rear view takes the rear view's scale
|
||||
scale = spec["skeleton"]["height_m"] / (hero["ground"] - hero["top"]) * spec["skeleton"]["unit"] / doc["unit"]
|
||||
ox, oy = o["origin"]
|
||||
front = Outline([((x - ox) * scale, (oy - y) * scale) for x, y in o["front"]])
|
||||
return front, Outline(o["side"]), o["view"][0], o["view"][1]
|
||||
|
|
@ -145,14 +153,10 @@ def wrap(front, side, az, el, stations, flat=0.55, chamfer=0.25, flare=0.0, leas
|
|||
return rings
|
||||
|
||||
|
||||
def arch(front, side, az, el, columns, stations, y_section=0.0, plan=None):
|
||||
"""Rings for a cap, one per station y (fore to aft or aft to fore, as given). `columns` name the section's
|
||||
points on the front outline, inboard to outboard and down: ("top", u) the outline's upper edge at u, ("out", v)
|
||||
its outboard edge at height v, ("in", v) its inboard edge, or ("at", u, v) a point of the view. The section
|
||||
stands at y_section; at each station it is carried between the side outline's bottom and top there, and its
|
||||
widths taken by plan[k] (default 1)."""
|
||||
def section(front, az, el, columns, y_section=0.0):
|
||||
"""A cap's section from one traced outline: `columns` as arch() names them, each carried back to depth y_section."""
|
||||
outboard_right = seen((-1, 0, 0), az, el)[0] > 0
|
||||
section = []
|
||||
out = []
|
||||
for column in columns:
|
||||
kind = column[0]
|
||||
if kind == "top":
|
||||
|
|
@ -162,15 +166,31 @@ def arch(front, side, az, el, columns, stations, y_section=0.0, plan=None):
|
|||
else:
|
||||
v = column[1]
|
||||
u = front.right(v) if (kind == "out") == outboard_right else front.left(v)
|
||||
section.append(back(u, v, y_section, az, el))
|
||||
z_lo, z_hi = min(p[2] for p in section), max(p[2] for p in section)
|
||||
out.append(back(u, v, y_section, az, el))
|
||||
return out
|
||||
|
||||
|
||||
def arch(front, side, az, el, columns, stations, y_section=0.0, plan=None, aft=None):
|
||||
"""Rings for a cap, one per station y (fore to aft or aft to fore, as given). `columns` name the section's
|
||||
points on the front outline, inboard to outboard and down: ("top", u) the outline's upper edge at u, ("out", v)
|
||||
its outboard edge at height v, ("in", v) its inboard edge, or ("at", u, v) a point of the view. The section
|
||||
stands at y_section; at each station it is carried between the side outline's bottom and top there, and its
|
||||
widths taken by plan[k] (default 1). `aft` is a second view of the cap, from behind: (outline, azimuth,
|
||||
elevation, columns), the same number of columns. A view from below shows the half of a cap nearer its camera, so
|
||||
the front outline's section is the cap's fore half and the aft outline's its rear half: a station behind the
|
||||
middle takes the aft section, one before it the front section, the middle station their mean."""
|
||||
fore = section(front, az, el, columns, y_section)
|
||||
rear = section(aft[0], aft[1], aft[2], aft[3], y_section) if aft else fore
|
||||
s_lo, s_hi = side.span(0, y_section)
|
||||
rings = []
|
||||
for k, y in enumerate(stations):
|
||||
w = 0.5 if abs(y - y_section) < 1e-6 else (0.0 if y > y_section else 1.0)
|
||||
sec = [[a + w * (b - a) for a, b in zip(p, q)] for p, q in zip(fore, rear)]
|
||||
z_lo, z_hi = min(p[2] for p in sec), max(p[2] for p in sec)
|
||||
lo, hi = side.span(0, y)
|
||||
lo, hi = z_lo + (lo - s_lo), z_hi + (hi - s_hi) # the side outline moves the section's foot and its crown
|
||||
sx = plan[k] if plan else 1.0
|
||||
rings.append([[p[0] * sx, y, lo + (p[2] - z_lo) * (hi - lo) / (z_hi - z_lo)] for p in section])
|
||||
rings.append([[p[0] * sx, y, lo + (p[2] - z_lo) * (hi - lo) / (z_hi - z_lo)] for p in sec])
|
||||
return rings
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -37,6 +37,14 @@ Round 4 (massing first, then attachment, then layering), none of it a Brokkr act
|
|||
foot_blocks a layered, splayed foot over a kit foot. Needs: the mass action above.
|
||||
silhouette / closeup / field_views, compare.py masks, joint close-ups and the comparison sheets. Needs: a
|
||||
concept outline that is not traced by hand (concepts.json).
|
||||
|
||||
Round 8:
|
||||
|
||||
canted_hip / lay(cant=True) the legs' splay: the hip's slew ring on a wedge, its axis tipped by the lean of
|
||||
the skeleton's knee-to-ankle line. Needs: a kit flange that can cant (the ring is seated loose).
|
||||
recessed_rams(on=) heel lugs on a cross ankle's spider, so the rams stay in plane on a splayed leg.
|
||||
Build["khaki:tag"] a second object of one material in a component, named for what it is, so a
|
||||
scored mask can leave it out.
|
||||
"""
|
||||
import json
|
||||
import math
|
||||
|
|
|
|||
|
|
@ -34,6 +34,10 @@ for name in names:
|
|||
lens = getattr(lib, "LENS", {}).get(name, 85.0)
|
||||
if name in getattr(lib, "MASKS", {}): # the scored outline: the armor the crop's mask traces, alone, at the same camera
|
||||
M.part_mask(rig, cam, radius, az, el, out / f"{name}_mask.png", (800, 800), lib.MASKS[name], margin=margin, lens=lens)
|
||||
for tag, (az2, el2, margin2, lens2) in getattr(lib, "SECOND", {}).get(name, {}).items(): # a second scored view of the same part
|
||||
M.part_mask(rig, cam, radius, az2, el2, out / f"{tag}_mask.png", (800, 800), lib.MASKS[name], margin=margin2, lens=lens2)
|
||||
if not os.environ.get("MECH_MASK_ONLY"):
|
||||
M.shot(rig, cam, radius, az2, el2, out / f"{tag}.png", (800, 800), margin=margin2, lens=lens2)
|
||||
if not os.environ.get("MECH_MASK_ONLY"):
|
||||
M.shot(rig, cam, radius, az, el, out / f"{name}.png", (800, 800), margin=margin, lens=lens)
|
||||
lines = getattr(lib, "LINES", {}).get(name)
|
||||
|
|
|
|||
|
|
@ -1,4 +1,6 @@
|
|||
"""SERAPH, round 7: the operator's concept sheet (images/30.webp) assembled from its components on its skeleton.
|
||||
"""SERAPH, round 8: the operator's concept sheet (images/30.webp) assembled from its components on its skeleton,
|
||||
the legs splayed on canted hips, the figure's long lines (her markup, images/33.webp; concepts.json "flow") carried by
|
||||
the chest's and the thighs' crease runs, the arms' pose and the pauldrons' outer faces.
|
||||
Each component is built to its inset or region of the sheet in seraph_parts.py and checked alone by part_bench.py
|
||||
(compare.py's components sheet sets each beside its crop); this file lays the biped on the solved skeleton and seats
|
||||
the components on it. What is not a matched component is said so where it is built."""
|
||||
|
|
@ -22,9 +24,9 @@ CFG = dict(pelvis=dict(span=1.4, ring_r=0.5, top_r=0.55, depth=1.1, height=1.5),
|
|||
knee="none", ankle="cross", ankle_drive="none", cross_drop=CROSS, elbow="none", waist_h=0.14, twist=-12,
|
||||
chassis=dict(width=3.0, depth=1.5, height=3.0, top_r=0.24, side_r=0.45, shoulder=0.66),
|
||||
arm=dict(pin_r=0.11, yoke=(0.6, 0.6), twist_r=0.3, upper=1.5, elbow=(0.5, 0.5), fore=1.0),
|
||||
aims={"L": ((0, 1, 0.05), None, (-0.05, 0.4, -1)), "R": ((0, 1, 0.25), None, (0.1, 1, -0.6))},
|
||||
aims={"L": ((0, 1, 0.05), None, (-0.05, 0.4, -1)), "R": ((0, 1, 0.25), None, (0.0, 0.75, -1.0))},
|
||||
guns={"L": (0.26, 1.5), "R": (0.32, 3.4)})
|
||||
M.lay(SK, CFG, hull_top=8.9, depth={"L": (0.55, -0.1), "R": (0.15, -0.25)}, elbow_y={"L": 0.1, "R": 0.45}, cant=True)
|
||||
M.lay(SK, CFG, hull_top=8.9, depth={"L": (0.55, -0.1), "R": (0.15, -0.25)}, elbow_y={"L": 0.1, "R": 0.75}, cant=True)
|
||||
CFG["foot"] = (CFG["foot"][0], CFG["foot"][1], CFG["foot"][2] - CROSS)
|
||||
FOOT, LINKS = CFG["foot"], CFG["links"]
|
||||
body = M.biped(CFG)
|
||||
|
|
@ -41,12 +43,13 @@ def put(name, fn, host, to_host, **kw):
|
|||
return build.done()
|
||||
|
||||
|
||||
# --- torso: chest plates, the cockpit in its gorget, the cooling assemblies ----------------------------------------------
|
||||
# --- torso: the chest and head (one shell), its flanks, the cooling assemblies ----------------------------------------------
|
||||
sh_x, sh_z = 0.5 * CFG["chassis"]["width"] + 0.47 * CFG["chassis"]["side_r"] + CFG["arm"]["yoke"][0], CFG["chassis"]["shoulder"] * CH
|
||||
put("Chest", SP.chest, core, T((0, 0.0, sh_z + 0.09))) # one shell, breast to cowl: the head is the chest's own top, the frame's roof stands under its slope
|
||||
put("Flanks", SP.torso_flanks, core, T((0, 0.0, sh_z + 0.09)))
|
||||
put("Cooling", SP.cooling, core, T((0, -1.0, sh_z + 0.14)))
|
||||
for side, sx in (("L", -1), ("R", 1)):
|
||||
put(f"Pauldron{side}", SP.pauldron, core, T((sx * sh_x, 0.0, sh_z)) @ (MIR if sx > 0 else Matrix.Identity(4))) # the cap's inboard edge stands at the shoulder's pivot
|
||||
put(f"Pauldron{side}", SP.pauldron, core, T((sx * (sh_x - 0.35), 0.0, sh_z)) @ (MIR if sx > 0 else Matrix.Identity(4))) # the cap's inboard edge stands 0.35 m inboard of the shoulder's pivot, as the rear view has it: its outer face is then the arm's outer line
|
||||
put("Battery", SP.battery, core, T((sh_x - 0.2, 1.45, sh_z + 0.05)) @ Matrix.Scale(0.7, 4))
|
||||
|
||||
# --- pelvis: the hip bearings on its sides, their axis across the mech, under their lames; the thigh plates stand in
|
||||
|
|
@ -67,7 +70,7 @@ for side, sx in (("L", -1), ("R", 1)):
|
|||
for side, arm in arms.items():
|
||||
sx, up, ey, fore = arm["sx"], arm["upper"], arm["elbow"], arm["fore"]
|
||||
U = CFG["arm"]["upper"]
|
||||
put(f"UpperArm{side}", SP.upper_arm, up, M.seat(up, (0, 0, -0.35), scale=0.85))
|
||||
put(f"UpperArm{side}", SP.upper_arm, up, M.seat(up, (0, 0, -0.35)))
|
||||
M.sleeve_hinge(f"Elbow{side}", ey, 0.2, sleeve=(0.64, 0.64))
|
||||
bpy.data.objects.remove(arm["cannon"], do_unlink=True)
|
||||
face = M.local_sockets(fore)["face"]
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@ ALONG_Y = F((0, 0, 0), (0, 1, 0), (0, 0, 1)) # a frame whose z is
|
|||
|
||||
VIEWS = {"cockpit": (0, 20, 0.52, 0), "battery": (24, 2, 0.78, 0), "cannon": (-20, 2, 0.6, -20), "emitter": (-32, 0, 0.66, -32),
|
||||
"cooling": (174, 3, 0.8, 0), "hip": (15, -11, 0.8, 0), "knee": (90, 0, 0.8, 0), "foot": (-40, 9, 0.85, 0),
|
||||
"chest": (30, -19, 0.8, 0), "pauldron": (8, -21, 0.85, 0), "thigh": (14, -7, 0.85, 14), "shin": (14, 2, 0.9, -15)}
|
||||
"chest": (30, -19, 0.8, 0), "upper_arm": (20, -10, 0.85, 0), "torso_flanks": (150, 5, 0.85, 0), "pauldron": (8, -21, 0.85, 0), "thigh": (14, -7, 0.85, 14), "shin": (14, 2, 0.9, -15)}
|
||||
# The last four are crops of the hero view, so their camera is the hero camera's direction onto that part of the
|
||||
# assembled build (seraph.py: 18 degrees round to the left, 17 m off, its eye 2.4 m up, so it looks up 19 degrees at
|
||||
# the chest and 21 at the left pauldron), and their pitch is the lean of the limb the part rides. An inset's camera
|
||||
|
|
@ -27,9 +27,10 @@ VIEWS = {"cockpit": (0, 20, 0.52, 0), "battery": (24, 2, 0.78, 0), "cannon": (-2
|
|||
LENS = {"chest": 200.0, "pauldron": 200.0, "thigh": 200.0, "shin": 200.0} # the hero camera's distance, on a part alone
|
||||
GROUND = {"foot": 0.8, "chest": 12.0, "pauldron": 12.0, "thigh": 8.0} # the bench's height for a part: the foot stands on the ground; a part seen from below is held clear of it
|
||||
ARMOR = lambda name: not name.endswith((".gunmetal", ".machine", ".rubber", ".ribs", ".amber", ".glow_blue")) # noqa: E731
|
||||
MASKS = {"pauldron": ARMOR, "chest": lambda name: name.endswith(".breast"), "thigh": ARMOR, "shin": ARMOR, # what a crop's traced mask outlines (concepts.json "masks")
|
||||
MASKS = {"pauldron": ARMOR, "chest": lambda name: name.endswith(".breast"), "thigh": lambda name: name.endswith(".plate"), "shin": lambda name: ARMOR(name) and not name.endswith(".calf"), # what a crop's traced mask outlines (concepts.json "masks")
|
||||
"knee": lambda name: True, "foot": lambda name: True}
|
||||
MIRROR = Matrix.Diagonal((-1.0, 1.0, 1.0, 1.0))
|
||||
SECOND = {"pauldron": {"pauldron_rear": (180, -12, 0.85, 200.0)}} # a part's second scored view: {mask tag: (azimuth, elevation, margin, lens)}; the rear view's camera stands far off
|
||||
FRAMES = {"pauldron": (-118, -14, 0.6, ("pauldron.gunmetal", "pauldron.shield"))} # (azimuth, elevation, margin, objects hidden): a second bench view, from inboard and below, of the frame a plate stands on
|
||||
|
||||
|
||||
|
|
@ -151,6 +152,8 @@ def emitter(b):
|
|||
d.box(T((0, L - 0.2, -0.5 * h - 0.1)), (0.6, 0.5, 0.16)) # the chin frame
|
||||
d.box(T((0, L - 0.02, -0.5 * h - 0.02)), (0.76, 0.08, 0.28))
|
||||
d.hull([(0.56, -0.4, 0.7), (0.5, 0.3, 0.74), (0.62, -0.4, -0.5), (0.58, 0.25, -0.4), (0.3, -0.4, 0.86), (0.28, 0.28, 0.86)], mirror=True) # the clamp block: the forearm's end
|
||||
for s in (-1, 1): # a guard slab each side (the hero and rear views; the inset shows the box bare): the forearm's outer line, which the pauldron's outer face comes down to
|
||||
k.hull([(s * 0.56, -0.5, 0.56), (s * 0.56, 0.62 * L, 0.5), (s * 0.56, -0.5, -0.5), (s * 0.56, 0.62 * L, -0.44), (s * 0.8, -0.4, 0.42), (s * 0.8, 0.56 * L, 0.38), (s * 0.8, -0.4, -0.38), (s * 0.8, 0.56 * L, -0.34)])
|
||||
|
||||
|
||||
def cooling(b):
|
||||
|
|
@ -225,10 +228,16 @@ def knee(b, full=True):
|
|||
d.lathe(out(0.22, 0.5, 0.0), [(0.5, 0), (0.5, 0.12), (0.42, 0.12)], 40)
|
||||
if full:
|
||||
k.prism(out(-0.05, 1.05, 0.05) @ RZ(-14), [(-0.55, -0.62), (0.3, -0.62), (0.62, -0.2), (0.62, 0.7), (-0.55, 0.7)], 0.16, 0.05, 0.94) # the thigh's plate
|
||||
rim = [(-0.62, -0.8), (0.14, -0.95), (0.64, -0.4), (0.64, 0.5), (0.16, 0.8), (-0.62, 0.44)] # the knee cap, in the cap's own frame
|
||||
cap = F((-0.42, 0.7, -0.5), (-0.75, 0.66, 0), (0, 0, 1))
|
||||
k.hull([(x, y, 0) for x, y in rim] + [(x * 0.62, y * 0.62, 0.26) for x, y in rim] + [(x, y, -0.2) for x, y in rim], cap)
|
||||
ringed_disc(b["gunmetal"], cap @ T((0.34, -0.66, 0.1)), 0.12, 0.08)
|
||||
ringed_disc(b["gunmetal"], F((0.62, 0.22, 0.5), (1, 0, 0), (0, 0, 1)), 0.4, 0.2) # the trunnion's inner end
|
||||
half = fit.band("seraph", "leg_l_in", "leg_l_out", "thigh.plate")
|
||||
top, low = half(0.24), half(0.06) # the thigh's two creases come down onto the cap's centre panel and leave it for the shin's guard
|
||||
rim = [(-0.46, -0.85), (0.0, -1.0), (0.46, -0.85), (0.62, -0.1), (0.56, 0.62), (-0.56, 0.62), (-0.62, -0.1)] # the knee cap, facing forward: x across, y up
|
||||
cap = F((0.0, 0.72, -0.45), (0, 1, 0), (0, 0, 1))
|
||||
k.hull([(x, y, 0) for x, y in rim] + [(x * 0.8, y * 0.8, 0.22) for x, y in rim] + [(x, y, -0.3) for x, y in rim], cap)
|
||||
k.hull([(-top, 0.6, 0.2), (top, 0.6, 0.2), (-low, -0.86, 0.2), (low, -0.86, 0.2), (-top, 0.5, 0.3), (top, 0.5, 0.3), (-low, -0.74, 0.3), (low, -0.74, 0.3)], cap) # its centre panel, proud
|
||||
for s in (-1, 1): # cheeks from the cap back to the trunnion
|
||||
k.hull([(s * 0.5, 0.5, 0.1), (s * 0.5, 0.5, -1.2), (s * 0.7, 0.44, 0.05), (s * 0.7, 0.44, -1.0), (s * 0.68, -0.1, -0.2), (s * 0.68, -0.1, -0.85), (s * 0.5, -0.1, -0.2), (s * 0.5, -0.1, -0.85)])
|
||||
ringed_disc(b["gunmetal"], cap @ T((0.3, -0.62, 0.2)), 0.1, 0.07)
|
||||
k.prism(out(0.0, -0.3, 0.06), [(-0.32, -0.42), (0.2, -0.42), (0.36, 0.0), (0.2, 0.4), (-0.32, 0.4)], 0.14, 0.04, 0.94) # the lapped plates behind it
|
||||
k.prism(out(-0.42, -0.25, 0.0), [(-0.3, -0.6), (0.28, -0.6), (0.34, 0.5), (-0.1, 0.62), (-0.3, 0.4)], 0.14, 0.04, 0.94)
|
||||
if full:
|
||||
|
|
@ -321,24 +330,15 @@ def chest(b, torso=True):
|
|||
proud = 0.09 * min(1.0, (len(rings) - 5 - i) / 2) # the panel's step dies out at the recess's rim
|
||||
ring.insert(2, list(Vector(ring[1]) + out.normalized() * 0.14 + Vector((0, -proud, 0)) if proud > 0 else Vector(ring[1]) + out * (0.3 if proud == 0 else 0.5)))
|
||||
LINES[b.name.lower() if b.name.lower() in ("chest", "cockpit") else "chest"] = {"chest_r": [list(r[1]) for r in rings[:-2]], "chest_l": [[-r[1][0], r[1][1], r[1][2]] for r in rings[:-2]]}
|
||||
import os
|
||||
if os.environ.get("MECH_RINGS"):
|
||||
lo, hi = (int(q) for q in os.environ["MECH_RINGS"].split(":"))
|
||||
rings = rings[lo:hi]
|
||||
if os.environ.get("MECH_NOSTEP"):
|
||||
rings = [r[:2] + r[3:] for r in rings]
|
||||
shell = {"mirror": True, "flip": True, "rings": rings, "creases": fit.creased(rings, skip_rings=tuple(len(rings) - int(q) for q in os.environ.get('MECH_SKIP', '2').split(',')))} # the shelf and the crown are left round: a hard ring there folds the wall
|
||||
shell = {"mirror": True, "flip": True, "rings": rings, "creases": fit.creased(rings, skip_rings=(len(rings) - 2,))} # the crown is left round: a hard ring there folds the wall
|
||||
name = b.name + ".breast"
|
||||
import os
|
||||
M.shell_action(name, shell, b, "khaki", thickness=float(os.environ.get("MECH_T", 0.07)), levels=1, bevel=0.014)
|
||||
M.shell_action(name, shell, b, "khaki", thickness=0.07, levels=1, bevel=0.014)
|
||||
cuts = [{"name": name + ".slit", "part": "box", "params": "width=1.04; height=0.16; depth=0.05", "origin": [0, 3, 1.08], "direction": [0, -1, 0]}] # a recess in the cowl's face; the visor stands in it
|
||||
if torso:
|
||||
cuts += [{"name": name + ".hatch", "part": "box", "params": "width=0.3; height=0.22; depth=0.03", "origin": [0, 3, 0.7], "direction": [0, -1, 0]},
|
||||
{"name": name + ".break", "part": "slab", "params": "gap=0.025; length=0.36; depth=0.03", "origin": [0, 3, -0.4], "direction": [0, -1, 0], "up": [1, 0, 0]},
|
||||
{"name": name + ".mark", "part": "cyl", "params": "r=0.075; depth=0.025", "origin": [0.62, 3, 0.05], "direction": [0, -1, 0]}]
|
||||
import os
|
||||
cuts = [c for c in cuts if c['name'].split('.')[-1] not in os.environ.get('MECH_NOCUT', '').split(',')]
|
||||
M.cuts_action(name, cuts) if cuts else None
|
||||
M.cuts_action(name, cuts)
|
||||
visor = F((0, 0.5, 1.08), (0, 1, 0.32), (0, 0, 1)) # the dark visor in the recess, two slanted amber eyes on it
|
||||
d.box(visor @ T((0, 0, -0.03)), (1.0, 0.2, 0.06))
|
||||
for s in (-1, 1):
|
||||
|
|
@ -379,25 +379,30 @@ def chest(b, torso=True):
|
|||
|
||||
def pauldron(b, arm=False):
|
||||
"""SHOULDER PAULDRON, the mech's left: outboard is -x; origin at the shoulder's pivot, which is the cap's inboard
|
||||
edge. One cap shell, a dome of planar facets: its section (inboard edge, crown, shoulder line, outer face,
|
||||
lower rim) is the crop's traced outline, and a side outline lowers it to a brow fore and aft (fit.arch). Facets
|
||||
0.5 m and more across carry a 0.16 m wall. Its lower rim is stepped into a tab by a notch; a panel line and a
|
||||
edge. One cap shell, a deep dome of planar facets fitted to two traced views (fit.arch): its fore half's section
|
||||
(inboard edge, crown, shoulder line, outer face, lower rim) is the hero crop's outline, its rear half's the rear
|
||||
view's, where the outer face comes down 0.8 m below the pivot over the upper arm; the rear view sets its size and
|
||||
a side outline lowers it to a brow fore and aft. Its outer face drops near plumb to the rim, so the arm's outer
|
||||
line leaves it without a step (the operator's pauldron line). A 0.12 m wall. Its lower rim is stepped into a tab by a notch; a panel line and a
|
||||
slot down the outer face. In front, the emblem's shield: a six-sided plate of its own hung before the shoulder,
|
||||
its outline the crop's, bent down its middle. Under the cap its frame: three ribs with lightening holes."""
|
||||
front, side, az, el = fit.load("seraph", "pauldron.cap")
|
||||
rings = fit.arch(front, side, az, el, [("in", 0.45), ("top", 0.32), ("top", 1.02), ("out", 0.25), ("out", -0.44)], [1.1, 0.7, 0.0, -0.7, -1.1], plan=[0.9, 0.98, 1.0, 0.98, 0.9])
|
||||
rear, _, raz, rel = fit.load("seraph", "pauldron.cap_rear")
|
||||
k = (rear.hi[0] - rear.lo[0]) / (front.hi[0] - front.lo[0]) # the hero view stands close to this shoulder and draws it large: the rear view sets its size
|
||||
front = front.scaled(k)
|
||||
rings = fit.arch(front, side, az, el, [("in", 0.45 * k), ("top", 0.32 * k), ("top", 1.02 * k), ("out", 0.25 * k), ("out", -0.44 * k)], [0.95, 0.72, 0.38, 0.0, -0.38, -0.72, -0.95], plan=[0.9, 0.96, 1.0, 1.0, 1.0, 0.96, 0.9],
|
||||
aft=(rear, raz, rel, [("in", 0.3), ("top", -0.3), ("top", -0.95), ("out", 0.2), ("out", -0.8)]))
|
||||
cap = {"rings": rings, "creases": fit.creased(rings)}
|
||||
name = b.name + ".cap"
|
||||
M.shell_action(name, cap, b, "khaki", thickness=0.16, levels=1, bevel=0.016)
|
||||
M.shell_action(name, cap, b, "khaki", thickness=0.12, levels=1, bevel=0.016)
|
||||
side_ray = {"direction": [1, 0, 0], "up": [0, 0, 1]}
|
||||
M.cuts_action(name, [
|
||||
{"name": name + ".line_a", "part": "slab", "params": "gap=0.03; length=0.8; depth=0.03", "origin": [-4, 0.3, -0.05], **side_ray},
|
||||
{"name": name + ".slot", "part": "box", "params": "width=0.16; height=0.4; depth=0.05", "origin": [-4, -0.2, 0.1], **side_ray},
|
||||
{"name": name + ".notch", "part": "box", "params": "width=0.5; height=0.3; depth=0.5", "origin": [-4, 0.28, -0.6], **side_ray}, # through the rim: what is left beside it is a tab
|
||||
])
|
||||
M.ribs_action(name, [{"origin": [0, y, 0], "normal": [0, 1, 0]} for y in (0.45, -0.05, -0.55)], standoff=0.03, depth=0.14, thickness=0.03, holes=0.34, posts=0.45, post_r=0.022)
|
||||
M.ribs_action(name, [{"origin": [0, y, 0], "normal": [0, 1, 0]} for y in (0.4, -0.05, -0.5)], standoff=0.03, depth=0.14, thickness=0.03, holes=0.34, posts=0.45, post_r=0.022)
|
||||
front, side, az, el = fit.load("seraph", "pauldron.shield")
|
||||
y0 = 1.2
|
||||
y0 = 1.05
|
||||
at = lambda px, py, dy=0.0: fit.back((px - 500) * front_scale, (120 - py) * front_scale, y0 + dy, az, el) # noqa: E731 a pixel of the crop, at the shield's depth
|
||||
front_scale = 9.8 / 758
|
||||
rows = [[(500, 155), (530, 171), (563, 163)], [(492, 135), (532, 137), (568, 138)], [(490, 112), (528, 112), (556, 112)], [(500, 90), (524, 90), (545, 90)]]
|
||||
|
|
@ -408,50 +413,66 @@ def pauldron(b, arm=False):
|
|||
M.cuts_action(plate, [{"name": plate + ".bracket", "part": "slot", "params": "width=0.3; height=0.06; depth=0.04", "origin": [-0.42, 4, -0.95], "direction": [0, -1, 0]},
|
||||
{"name": plate + ".bolt", "part": "cyl", "params": "r=0.05; depth=0.04", "origin": [-0.75, 4, -0.5], "direction": [0, -1, 0]}])
|
||||
d = b["gunmetal"]
|
||||
d.box(T((-0.5, 0.95, -0.45)), (0.5, 0.4, 0.3)) # the shield's bracket to the frame
|
||||
d.box(T((-0.5, 0.85, -0.45)), (0.5, 0.4, 0.3)) # the shield's bracket to the frame
|
||||
if arm:
|
||||
upper_arm(b, Matrix.Translation((-0.55, 0, 0)))
|
||||
|
||||
|
||||
def upper_arm(b, at=Matrix.Identity(4)):
|
||||
"""The upper arm under a pauldron, hanging along -z from the shoulder's pivot: what the cap covers, two boxed
|
||||
tiers, a ringed elbow disc on each side and a ribbed strip down the front between them."""
|
||||
def upper_arm(b, at=Matrix.Identity(4), r=0.56):
|
||||
"""The upper arm under a pauldron, hanging along -z from the shoulder's pivot: a dark shoulder block the cap
|
||||
covers, then a ten-sided armoured column of radius `r` in three lapped tiers, each a little smaller than the one
|
||||
over it and lipped where it laps, a dark neck, a ringed elbow disc on each side and a ribbed strip down the front."""
|
||||
k, d = b["khaki"], b["gunmetal"]
|
||||
d.box(at @ T((0.05, -0.1, 0.1)), (1.2, 1.4, 1.0))
|
||||
k.hull([(x, y, z) for x in (-0.45, 0.45) for y in (-0.5, 0.42) for z in (-0.5,)] + [(x, y, -1.15) for x in (-0.4, 0.4) for y in (-0.46, 0.4)], at)
|
||||
k.hull([(x, y, -1.2) for x in (-0.37, 0.37) for y in (-0.44, 0.38)] + [(x, y, -1.75) for x in (-0.33, 0.33) for y in (-0.4, 0.34)], at)
|
||||
d.box(at @ T((0, 0.0, -2.0)), (0.6, 0.6, 0.6))
|
||||
d.box(at @ T((0.05, -0.1, 0.1)), (1.2, 1.3, 1.0))
|
||||
down = at @ F((0, 0, 0), (0, 0, -1), (0, 1, 0)) @ RZ(18)
|
||||
for z0, z1, q in ((0.3, 0.95, 1.0), (0.85, 1.45, 0.92), (1.35, 1.8, 0.84)):
|
||||
k.lathe(down @ T((0, 0, z0)), [(0.0, 0.0), (0.86 * q * r, 0.0), (q * r, 0.08), (q * r, z1 - z0 - 0.06), (0.93 * q * r, z1 - z0), (0.0, z1 - z0)], 10)
|
||||
d.cylinder(down @ T((0, 0, 1.95)), 0.6 * r, 0.4, 16)
|
||||
for x in (-1, 1): # the elbow's discs stand on its sides: its axis runs across the arm, as the hero view has it
|
||||
ringed_disc(d, at @ F((x * 0.3, 0.0, -2.1), (x, 0, 0), (0, 0, 1)), 0.3, 0.14)
|
||||
track(d, at @ Vector((0, 0.36, -1.72)), at @ Vector((0, 0.36, -2.5)), 0.3, 6, 0.1, (0, 1, 0))
|
||||
ringed_disc(d, at @ F((x * 0.34, 0.0, -2.1), (x, 0, 0), (0, 0, 1)), 0.34, 0.14)
|
||||
track(d, at @ Vector((0, 0.36, -1.82)), at @ Vector((0, 0.36, -2.5)), 0.3, 6, 0.1, (0, 1, 0))
|
||||
|
||||
|
||||
def torso_flanks(b):
|
||||
"""TORSO FLANKS, in the chest's frame (origin 0.09 m over the shoulders' axis): what closes the frame round the
|
||||
breast, as the hero and rear views have it. Each side: a tapered flank block from under the shoulder down to
|
||||
the waist, leaving the abdomen's dark column and hoses open in front; an eight-sided armoured collar round the
|
||||
shoulder's bearing; a shoulder-blade plate behind the shoulder, beside the cooling units."""
|
||||
k = b["khaki"]
|
||||
for s in (-1, 1):
|
||||
k.hull([(s * x, y, -0.74) for x, y in ((1.0, 0.95), (1.5, 0.78), (1.56, -0.3), (1.45, -0.85), (1.0, -0.9))] + [(s * x, y, -1.85) for x, y in ((0.82, 0.6), (1.2, 0.45), (1.25, -0.3), (1.15, -0.75), (0.82, -0.8))])
|
||||
k.hull([(s * 0.95, 0.5, -0.74), (s * 1.5, 0.5, -0.74), (s * 0.95, 0.9, -0.74), (s * 1.4, 0.82, -0.74), (s * 0.95, 0.5, 0.5), (s * 1.48, 0.5, 0.5), (s * 0.95, 0.62, 0.5), (s * 1.36, 0.6, 0.5)]) # the breast's side, before the shoulder
|
||||
k.lathe(F((s * 1.42, 0, -0.09), (s, 0, 0), (0, 0, 1)) @ RZ(22.5), [(0.64, 0), (0.86, 0), (0.86, 0.2), (0.74, 0.3), (0.64, 0.3)], 8)
|
||||
k.hull([(s * 0.95, -0.66, -0.74), (s * 1.55, -0.66, -0.74), (s * 0.95, -0.95, -0.74), (s * 1.45, -0.95, -0.74), (s * 0.95, -0.66, 0.62), (s * 1.5, -0.66, 0.62), (s * 0.95, -0.9, 0.5), (s * 1.4, -0.9, 0.5)])
|
||||
|
||||
|
||||
def thigh(b):
|
||||
"""THIGH PLATE, the mech's left thigh from the front: outboard is -x; origin at the plate's middle, z up. One
|
||||
tall front shell, mirrored, its rings placed by fit.wrap from the crop's traced outline: a flat front between
|
||||
two creases, a facet each side turning back along the leg, its top edge leaning back; a 0.13 m wall. Over its
|
||||
lower part a second shell, the lapped plate with its centre notch; down the outboard side a strip plate turned
|
||||
back along the leg. It straddles the hip's axis: the hip stands 0.1 m above its middle."""
|
||||
"""THIGH, the mech's left thigh from the front: outboard is -x; origin 0.12 m below the hip's axis, z up along the
|
||||
leg, the knee at z = -2.1. One long front shell, mirrored: its upper two thirds placed by fit.wrap from the
|
||||
crop's traced outline, then carried on down, tapering, to just over the knee. Its centre panel stands 0.07 m
|
||||
proud between two creases that converge downward on the operator's two leg lines (fit.band): LINES["thigh"];
|
||||
the knee cap takes them on. A 0.1 m wall. Round the leg: an outboard cuisse from the front plate's flank to
|
||||
the back of the leg, bulged at mid-thigh; a lower inboard cuisse under the hip's drum; a rear plate across
|
||||
the upper back; a cap over the top. The back of the leg below that plate is left open, as the rear view has it."""
|
||||
front, side, az, el = fit.load("seraph", "thigh.plate")
|
||||
rings = fit.wrap(front, side, az, el, [(-1.03, 0.82, -0.88), -0.5, 0.05, 0.7, (1.03, 0.8, 0.7)], flat=0.5, chamfer=0.3, flare=0.03)
|
||||
rings = fit.wrap(front, side, az, el, [(-1.75, 0.85, -0.88), (-1.2, 0.95, -0.88), -0.5, 0.05, (0.7, 1.22), (1.03, 1.16, 0.7)], flat=0.5, chamfer=0.3, flare=0.03)
|
||||
half = fit.band("seraph", "leg_l_in", "leg_l_out", "thigh.plate")
|
||||
for ring in rings: # the lines run from the knee guard (z -2.4) to the thigh's top
|
||||
ring[1][0] = min(0.82 * half((ring[0][2] + 2.4) / 3.43), ring[2][0] - 0.24) # the band at the plate's own size (the hero view draws this leg large), and no facet under 0.12 m beside it
|
||||
out = Vector(ring[2]) - Vector(ring[1])
|
||||
ring.insert(2, list(Vector(ring[1]) + out.normalized() * 0.1 + Vector((0, -0.07, 0))))
|
||||
LINES["thigh"] = {"leg_l_in": [list(r[1]) for r in rings], "leg_l_out": [[-r[1][0], r[1][1], r[1][2]] for r in rings]}
|
||||
main = {"mirror": True, "flip": True, "rings": rings, "creases": fit.creased(rings)}
|
||||
name = b.name + ".plate"
|
||||
M.shell_action(name, main, b, "khaki", thickness=0.13, levels=1, bevel=0.014)
|
||||
yf = rings[1][0][1]
|
||||
M.cuts_action(name, [{"name": name + ".line", "part": "slab", "params": "gap=0.025; length=0.5; depth=0.03", "origin": [0, 3, 0.32], "direction": [0, -1, 0], "up": [1, 0, 0]},
|
||||
{"name": name + ".flank_a", "part": "slab", "params": "gap=0.025; length=0.8; depth=0.03", "origin": [-3, 0.4, 0.3], "direction": [1, 0, 0], "up": [0, 0, 1]}])
|
||||
hw = rings[1][1][0]
|
||||
lower = {"mirror": True, "flip": True, "rings": [[[0, yf + 0.1, -0.98], [hw + 0.02, yf + 0.1, -0.98], [hw + 0.14, yf - 0.12, -0.98]],
|
||||
[[0, yf + 0.1, -0.45], [hw + 0.02, yf + 0.1, -0.45], [hw + 0.14, yf - 0.12, -0.45]]],
|
||||
"creases": [{"column": 1, "from": 0, "to": 1, "weight": 1.0}]}
|
||||
over = b.name + ".lower"
|
||||
M.shell_action(over, lower, b, "khaki", thickness=0.09, levels=1, bevel=0.012)
|
||||
M.cuts_action(over, [{"name": over + ".tab", "part": "box", "params": "width=0.3; height=0.24; depth=0.3", "origin": [0, 3, -0.52], "direction": [0, -1, 0]}])
|
||||
edge_x = rings[2][3][0]
|
||||
strip = {"rings": [[[-edge_x - 0.08, yf - 0.22, z0], [-edge_x - 0.12, yf - 0.62, z1]] for z0, z1 in ((-0.6, -0.7), (0.55, 0.45))]}
|
||||
edge = b.name + ".strip"
|
||||
M.shell_action(edge, strip, b, "khaki", thickness=0.1, levels=1, bevel=0.012)
|
||||
M.cuts_action(edge, [{"name": f"{edge}.bolt{j}", "part": "cyl", "params": "r=0.045; depth=0.03", "origin": [-3, yf - 0.4, z], "direction": [1, 0, 0]} for j, z in enumerate((0.25, -0.35))])
|
||||
M.shell_action(name, main, b, "khaki", thickness=0.1, levels=1, bevel=0.014)
|
||||
M.cuts_action(name, [{"name": name + ".line", "part": "slab", "params": "gap=0.025; length=0.3; depth=0.03", "origin": [0, 3, 0.32], "direction": [0, -1, 0], "up": [1, 0, 0]},
|
||||
{"name": name + ".lap", "part": "slab", "params": "gap=0.03; length=0.3; depth=0.03", "origin": [0, 3, -0.8], "direction": [0, -1, 0], "up": [1, 0, 0]}])
|
||||
k = b["khaki:cuisse"]
|
||||
outer = ((0.95, 0.6, 0.15, -0.35), (0.4, 0.84, 0.2, -0.62), (-0.5, 0.9, 0.2, -0.7), (-1.6, 0.66, 0.2, -0.55)) # (z, the outer face's x, its front y, its rear y)
|
||||
k.hull([q for z, xo, yf, yb in outer for q in ((-xo, yf, z), (-xo, yb + 0.25, z), (-xo + 0.3, yb, z), (-0.28, yf, z), (-0.28, yb, z))])
|
||||
k.hull([q for z, xi, yb in ((-0.62, 0.72, -0.5), (-1.0, 0.86, -0.62), (-1.6, 0.7, -0.5)) for q in ((xi, 0.2, z), (xi, yb + 0.2, z), (xi - 0.2, yb, z), (0.36, 0.2, z), (0.36, yb, z))])
|
||||
k.hull([(-0.5, -0.5, 0.9), (0.55, -0.5, 0.9), (-0.55, -0.78, 0.3), (0.6, -0.74, 0.3), (-0.5, -0.72, -0.55), (0.5, -0.7, -0.55), (-0.5, -0.45, -0.55), (0.5, -0.45, -0.55)])
|
||||
k.hull([(-0.6, 0.45, 0.92), (0.45, 0.45, 0.92), (-0.6, -0.4, 0.92), (0.5, -0.5, 0.92), (-0.4, 0.3, 1.14), (0.3, 0.3, 1.14), (-0.4, -0.3, 1.14), (0.3, -0.3, 1.14)])
|
||||
|
||||
|
||||
def shin(b):
|
||||
|
|
@ -474,6 +495,10 @@ def shin(b):
|
|||
(s * 0.74, -0.4, 0.8), (s * 0.84, -0.4, 0.0), (s * 0.7, -0.4, -0.9), (s * 0.45, 0.2, 0.9), (s * 0.45, -0.4, 0.8), (s * 0.45, -0.4, -0.9), (s * 0.45, 0.2, -1.0)])
|
||||
k.hull([(0.5, 0.62, -1.15), (0.74, 0.2, -1.2), (0.62, 0.86, -1.6), (0.9, 0.2, -1.62), (0.74, -0.4, -1.2), (0.86, -0.4, -1.6), (0.3, 0.6, -1.15), (0.3, 0.9, -1.6)], mirror=True) # the ankle skirt
|
||||
d.box(T((0, 0.0, -0.1)), (0.8, 0.8, 3.0))
|
||||
calf = b["khaki:calf"]
|
||||
for s in (-1, 1): # the calf: a bulged mass each side of the rams' channel, which stays open down the back
|
||||
calf.hull([q for z, xo, yb in ((0.95, 0.72, -0.8), (0.2, 0.94, -1.14), (-0.5, 0.86, -1.02), (-1.05, 0.66, -0.74)) for q in ((s * xo, -0.3, z), (s * xo, yb + 0.25, z), (s * (xo - 0.22), yb, z), (s * 0.45, yb, z), (s * 0.45, -0.3, z))])
|
||||
calf.hull([(-0.47, -0.86, 0.95), (0.47, -0.86, 0.95), (-0.47, -1.16, 0.25), (0.47, -1.16, 0.25), (-0.47, -1.08, -0.1), (0.47, -1.08, -0.1), (-0.47, -0.8, 0.95), (0.47, -0.8, -0.1), (-0.47, -0.8, -0.1), (0.47, -0.8, 0.95)]) # a plate over the rams' upper half
|
||||
|
||||
|
||||
PARTS = {f.__name__: f for f in (cockpit, battery, cannon, emitter, cooling, hip, knee, foot, chest, pauldron, thigh, shin)}
|
||||
PARTS = {f.__name__: f for f in (cockpit, battery, cannon, emitter, cooling, hip, knee, foot, chest, pauldron, thigh, shin, upper_arm, torso_flanks)}
|
||||
|
|
|
|||
Loading…
Reference in a new issue