A mech game prototype, pushed by Gemini 4 Argon
agent (cont.)
+1:05read_file{"Path":"~/work/sortie/kit/makers/pattern.py"}
input
{ "Path": "~/work/sortie/kit/makers/pattern.py" }result, 576 lines
Showing lines 1-575 of 575 1: """Common pattern maker plates: the Administration's licensed maker, whose export model is the striker. 2: 3: Motif (docs/visual-language.md): rectangles with one 45 degree clip on the outboard top corner, a 4: recessed service band across each main plate (chest, shoulders, backpack) and nowhere else, flat 5: and square, one chamfer width. Standard issue: plain but handsome, few large plates. A leg is three 6: masses: a short thigh, a long shin that is the widest part of the leg, and a big foot, with a hard 7: knee block on the shin. Proportions from docs/study-proportions.md, set by frame_std.proportion. 8: 9: Every plate is a closed solid (kit/makers/shell.py): a front outline and a side outline intersected, 10: so a plate has a real side profile. No plate is ever hollow with its inside showing. Weight grades 11: are thickness, size and add-ons of the same outlines, and every grade is finished from every angle: 12: light thin plates, the outlines shrunk: a front plate and a back plate on each limb, wide gaps 13: between them where the frame shows 14: medium a front block and a fuller back plate behind a gap 15: heavy one block that wraps the segment, the outlines grown, plus add-ons (stand off plates, packs). 16: The heavy legs keep the medium outlines and differ by their added pieces alone. 17: 18: plates(J, "medium") one grade everywhere 19: plates(J, {"chest": "heavy", "default": "light"}) grade per segment, any mix 20: 21: Joints show at the sides and back, the front of every knee and the back of every elbow get a cap, 22: the cockpit socket gets an armoured hatch that leaves with the pod. 23: 24: Livery roles, colour blocked like the line mechs' two tone paint: main for most plates, accent as a 25: few big blocks (the upper breastplate and the hatch, the boots, the head's cheeks, a panel on the 26: backpack's upper back), long bounded panels along the leg (shin fronts, outer thighs) and the bands, 27: trim for small lights. About 78 percent main and 22 accent by plate area. Nothing in accent runs across 28: the leg: the knee, the thigh's lip and the shin cuff stay main. 29: 30: The head is a closed piece on every grade and the maker's mark: a visor slit under a jutting brow, a 31: chin plate with cheek vents, an offset comms blade on the left temple, a square sensor housing on the 32: right and a neck guard behind with a vent slot. Bearing anchors (bearing.*) sit on the left 33: shoulder's outer face, the chest left, the right shoulder (company mark) and both shin fronts. 34: """ 35: from mathutils import Matrix, Vector 36: 37: import frame_std 38: from lib import clip, copy, cylinder, empty, halves, loft, merge, nozzle, octo, prism, rot, solid, transform, two_view 39: from makers.shell import Plates, back, banded, clip_u, clip_v, clipped, front, inset, inset_panel, outer, plan, shear, shell, subtract, surface, text_row 40: from mech import gltf_dir, nozzle_pair, place 41: 42: CHAMFER = .04 43: GRADES = {"light": dict(t=.1, grow=-.06), "medium": dict(t=.16, grow=0.0), "heavy": dict(t=.24, grow=.07)} 44: SEGMENTS = ("head", "chest", "waist", "pelvis", "shoulder", "upperarm", "forearm", "thigh", "shin", "foot", "backpack", "binder") 45: ROOF = frame_std.ROOF 46: 47: 48: def lr(J, part): 49: return J[part, "L"], J[part, "R"] 50: 51: 52: OPPOSITE = {"-x": "+x", "+x": "-x", "-y": "+y", "+y": "-y", "-z": "+z", "+z": "-z"} 53: 54: 55: def grown(g, *polys, k=1.0): 56: d = GRADES[g]["grow"] * k 57: return [inset(p, -d) if p is not None else None for p in polys] 58: 59: 60: def plate(P, name, g, front_o, side_o, jl, jr=None, role="main", outward=("-y",), band=None, top_o=None, fx=None, grow=1.0, ch=None, 61: cut=None, back=False, split=None, back_dir=None, t=None, hi_role=None, back_block=None): 62: """One closed plate in a grade. Light: a thin plate on the outward face. Medium and heavy: the 63: whole block. With back=True light gets a thin back plate too (on back_dir, the face opposite the 64: outward one unless given), and with a split medium's block stops at y = split and gets the back 65: plate behind a gap that shows the frame. With a band, the 66: parts above and below it are separate pieces. fx transforms the finished solids (the foot's fit). 67: ch = (front, back) chamfers the plan corners when there is no plan outline. cut() makes a solid to 68: take out of every front piece (an opening). hi_role paints the piece above the band (a colour block). 69: back_block = y0 makes light's back plate a closed block behind y0, narrower than the front: a thin 70: plate on a curved back face reads as a loop from the side.""" 71: f, s, tp = grown(g, front_o, side_o, top_o, k=grow) 72: if tp is None and ch is not None: 73: tp = plan(f, s, *ch) 74: t = t or GRADES[g]["t"] 75: op = tuple(outward) if g == "light" else None 76: split_medium = g == "medium" and back and split is not None 77: sf = clip_u(s, -60, split) if split_medium else s 78: if back and g == "light" and back_block is not None: 79: bf, bs = inset(f, .1), clip_u(s, back_block, 60) 80: bk = shell(bf, bs, top=plan(bf, bs, *ch) if ch else None) 81: P.solid(f"{name}_back", fx(bk) if fx else bk, role if role != "accent" else "main", jl, jr) 82: elif back and (g == "light" or split_medium): 83: bk = shell(f, s, t * .8, (back_dir or OPPOSITE[outward[0]],), tp) 84: P.solid(f"{name}_back", fx(bk) if fx else bk, role if role != "accent" else "main", jl, jr) 85: fx0 = fx or (lambda bm: bm) 86: fx = (lambda bm: fx0(subtract(bm, cut()))) if cut else fx0 87: if band is None: 88: P.solid(name, fx(shell(f, sf, t, op, tp)), role, jl, jr) 89: return f, s 90: pieces, b = banded(f, sf, t, op, band, top=tp) 91: for i, bm in enumerate(pieces): 92: hi = sum(v.co.z for v in bm.verts) / max(len(bm.verts), 1) > band[1] 93: P.solid(f"{name}_{'hi' if hi else 'lo'}", fx(bm), (hi_role or role) if hi else role, jl, jr) 94: P.solid(f"{name}_band", fx(b), "accent", jl, jr, bevel=.02) 95: return f, s 96: 97: 98: def marks_front(P, name, side_o, z, blocks, jl, jr=None): 99: """Stencil blocks on the front face of a plate, following its slope at height z.""" 100: y, k = surface(side_o, z, 0, -1) 101: P.marks(name, front(y), 0, blocks, jl, jr, lean=shear("y", k, z)) 102: 103: 104: def marks_outer(P, name, front_o, z, blocks, jl, jr=None): 105: """Stencil blocks on the outer (+x) face of a plate. Blocks are (u, v): u = -y, v = z.""" 106: x, k = surface(front_o, z, 0, 1) 107: P.marks(name, outer(x), 0, blocks, jl, jr, lean=shear("x", k, z)) 108: 109: 110: def bearing_at(name, at, normal, parent, size): 111: n = Vector(normal).normalized() 112: return empty(f"bearing.{name}", Vector(at) + n * .02, parent, dir=gltf_dir(-n), size=size) 113: 114: 115: # ---- head ----------------------------------------------------------------------------------------------- 116: HEAD_SCALE = 1.24 # the helmet is drawn at the frame core size, then scaled up about the neck 117: HEAD_DROP = .6 # and seated down onto the collar, the chin level with the pauldron tops 118: 119: 120: def head(P, J, g): 121: H = J["head"] 122: before = set(H.children) 123: _head(P, J, g) 124: m = Matrix.Translation((0, 0, 15.9 - HEAD_DROP)) @ Matrix.Scale(HEAD_SCALE, 4) @ Matrix.Translation((0, 0, -15.9)) 125: for o in set(H.children) - before: 126: if o.type == "MESH": 127: for v in o.data.vertices: 128: v.co = m @ v.co 129: 130: 131: def _head(P, J, g): 132: H = J["head"] 133: k = {"light": -.04, "medium": 0.0, "heavy": .05}[g] 134: w = .6 + k 135: top_z = 17.04 + k 136: # the helmet: a jutting brow over the visor, the crown sloping back 137: hf = [(-w, 16.44), (w, 16.44), (w + .02, 16.82), (w - .22, top_z), (-w + .22, top_z), (-w - .02, 16.82)] 138: yb = .58 139: hs = [(-.84 - k, 16.47), (-.64, 16.42), (yb, 16.38), (yb + .02, 16.88), (yb - .28, top_z), (-.42, top_z), (-.74 - k, 16.76)] 140: P.solid("head_helmet", shell(hf, hs, .1), "main", H) 141: # the visor: a dark band recessed under the brow, one glowing slit with a hot spot that tracks 142: P.solid("head_visor", prism([(-w + .08, 16.2), (w - .08, 16.2), (w - .08, 16.45), (-w + .08, 16.45)], -.64, .3, "xz"), "visor", H, bevel=.015) 143: solid(f"{P.n}_head_slit", prism([(-.42, 16.29), (.42, 16.29), (.42, 16.36), (-.42, 16.36)], -.665, -.63, "xz"), "glow_eye", H, outline=False) 144: solid(f"{P.n}_head_pupil", prism([(.1, 16.27), (.24, 16.27), (.24, 16.38), (.1, 16.38)], -.675, -.64, "xz"), "glow_hot", H, outline=False) 145: # the head is closed on every grade: chin, cheeks and a neck guard behind 146: chin_f = [(-.44, 16.2), (.44, 16.2), (.36, 15.98), (.14, 15.86), (-.14, 15.86), (-.36, 15.98)] 147: chin_s = [(-.68, 16.2), (-.7, 16.06), (-.54, 15.86), (.08, 15.86), (.08, 16.2)] 148: P.solid("head_chin", shell(chin_f, chin_s), "main", H) 149: cheek = shell([(.4, 15.98), (w + .02, 16.06), (w + .02, 16.44), (.4, 16.44)], [(-.64, 16.04), (.04, 16.04), (.04, 16.44), (-.62, 16.44)], 150: top=[(.4, -.66), (w - .1, -.64), (w + .02, -.5), (w + .02, .05), (.4, .05)]) 151: # the cheeks are the head's accent, the ear housings either side of the visor 152: P.solid("head_cheek", cheek, "accent", H, H) 153: # the neck guard: the helmet's back carried down over the nape and flaring back at its lower edge, 154: # one piece with a recessed vent slot across it (a red lamp in the slot on medium and heavy) 155: flare = .16 + 2 * k 156: nape_f = [(-w - .04, 15.94), (w + .04, 15.94), (w, 16.44), (-w, 16.44)] 157: nape_s = [(-.02, 16.44), (yb + .02, 16.44), (yb + flare, 15.94), (-.02, 15.94)] 158: vz0, vz1 = 16.1, 16.32 159: guard = subtract(shell(nape_f, nape_s, top=plan(nape_f, nape_s, .1, .16)), frame_std.box(-.42, .42, yb - .02, yb + .5, vz0, vz1)) 160: P.solid("head_back", guard, "main", H) 161: P.solid("head_vent_slot", frame_std.box(-.43, .43, yb - .06, yb - .01, vz0, vz1), "joint", H, bevel=.005) 162: if g != "light": 163: rear = merge(*[frame_std.box(-.4, .4, yb - .02, yb + .05, z, z + .04) for z in (16.14, 16.2, 16.26)]) 164: P.solid("head_rear", rear, "frame", H, bevel=.005) 165: solid(f"{P.n}_head_lamp", frame_std.box(-.34, -.18, yb - .02, yb + .07, vz0 + .03, vz1 - .03), "lamp_red", H) 166: # add-ons: mouth slits, cheek vents 167: slits = merge(*[prism([(x - .025, 15.96), (x + .025, 15.96), (x + .025, 16.12), (x - .025, 16.12)], -.72, -.6, "xz") for x in (-.07, .07)]) 168: P.solid("head_mouth", slits, "frame", H, bevel=.005) 169: P.solid("head_vent_well", prism([(-.5, 16.1), (-.1, 16.1), (-.1, 16.36), (-.5, 16.36)], w - .02, w + .03, "yz"), "joint", H, H, bevel=.005) 170: vents = merge(*[prism([(-.48, z), (-.12, z), (-.12, z + .05), (-.48, z + .05)], w, w + .05, "yz") for z in (16.15, 16.25)]) 171: P.solid("head_vent", vents, "frame", H, H, bevel=.005) 172: # the offset comms blade on the left temple, swept back: the outline breaker 173: blade = [(-.26, 16.72), (.2, 16.72), (.64, 17.42 + k), (.52, 17.5 + k), (-.02, 16.96)] 174: P.solid("head_blade_shoe", prism([(-.24, 16.6), (.22, 16.6), (.16, 16.82), (-.18, 16.82)], w - .02, w + .12, "yz"), "frame", H, bevel=.015) 175: P.solid("head_blade", prism(blade, w + .04, w + .1, "yz"), "main", H, bevel=.01) 176: solid(f"{P.n}_head_blade_tip", prism([(.46, 17.28 + k), (.58, 17.28 + k), (.64, 17.42 + k), (.52, 17.5 + k)], w + .03, w + .11, "yz"), 177: "trim", H) 178: # a square sensor housing set into the right temple, its lens looking forward 179: P.solid("head_pod", frame_std.box(-w - .14, -w + .06, -.52, .06, 16.5, 16.78), "frame", H, bevel=.012) 180: solid(f"{P.n}_head_pod_lens", frame_std.box(-w - .1, -w + .02, -.55, -.5, 16.56, 16.72), "glow_eye", H, outline=False) 181: if g == "heavy": 182: # ribs down the neck guard either side of the slot 183: for s, sx in (("L", 1), ("R", -1)): 184: xs = sorted((.5 * sx, .62 * sx)) 185: P.solid(f"head_nape.{s}", shell([(xs[0], 15.96), (xs[1], 15.96), (xs[1], 16.5), (xs[0], 16.5)], 186: [(yb - .1, 16.5), (yb + .1, 16.5), (yb + flare + .08, 15.96), (yb - .1, 15.96)]), "main", H) 187: P.marks("head_code", front(-.7), 0, [(-.5, 16.62, -.36, 16.7), (-.32, 16.62, -.26, 16.7)], H, 188: lean=shear("y", .42, 16.66)) 189: 190: 191: # ---- torso ---------------------------------------------------------------------------------------------- 192: PEC_F = [(.7, 12.6), (1.44, 12.6), (1.64, 13.2), (1.64, 14.5), (1.24, 14.9), (.7, 14.9)] 193: PEC_FRONT = [(-1.14, 14.98), (-1.54, 14.6), (-1.56, 13.84), (-1.2, 12.6)] 194: 195: 196: def chest(P, J, g): 197: T = J["torso"] 198: back_y = {"light": -.3, "medium": -.26, "heavy": .96}[g] 199: side_o = PEC_FRONT + [(back_y, 12.6), (back_y, 14.98)] 200: top_o = [(.7, -1.72), (1.26, -1.68), (1.64, -1.3), (1.64, back_y - (.3 if g == "heavy" else -.01)), (.7, back_y + .01)] 201: if g == "heavy": 202: top_o.insert(4, (1.42, back_y + .01)) 203: # one intake opening low in each pec, beside the hatch (the light grade keeps its pecs plain) 204: x0, x1, z0, z1 = .9, 1.42, 12.94, 13.3 205: # the upper breastplate is the chest's accent block, the hatch carries it down the middle 206: f, s = plate(P, "chest_pec", g, PEC_F, side_o, T, T, outward=("-y",), band=(13.44, 13.66), top_o=top_o, hi_role="accent", 207: cut=None if g == "light" else (lambda: frame_std.box(x0, x1, -2.2, -1.06, z0, z1))) 208: if g != "light": 209: P.solid("chest_intake", frame_std.box(x0 - .02, x1 + .02, -1.16, -.98, z0 - .02, z1 + .02), "joint", T, T, bevel=.01) 210: bars = merge(*[frame_std.box(x - .03, x + .03, -1.4, -1.12, z0, z1) for x in (1.03, 1.16, 1.29)]) 211: P.solid("chest_intake_bars", bars, "frame", T, T, bevel=.008) 212: marks_front(P, "chest_code", s, 14.1, text_row(.9, 14.06, .07, (.2, .1, .26)), T, T) 213: y, k = surface(s, 14.3, 0, -1) 214: bearing_at("chest", (1.2, y, 14.3), (0, -1, k), T, .42) 215: # the cockpit hatch: armour in plate colour over the socket, flush with the pecs, riding the cockpit 216: # joint so it leaves with the pod. The dark well round it is the seam that shows the pod outline 217: C = J["cockpit"] 218: th = {"light": .1, "medium": .16, "heavy": .22}[g] 219: hx = {"light": .66, "medium": .63, "heavy": .57}[g] # a thin seam to the pecs on every grade 220: hf = [(-hx, 13.04), (hx, 13.04), (hx, 14.2), (hx - .12, 14.32), (-hx + .12, 14.32), (-hx, 14.2)] 221: hs = [(-1.5, 14.32), (-1.54, 13.86), (-1.3, 13.04), (-1.0, 13.04), (-1.0, 14.32)] 222: P.solid("hatch", shell(hf, hs, th), "accent", C) 223: # the socket surround: a dark recess round the hatch, the seam that shows the pod outline 224: P.solid("hatch_well", frame_std.box(-.72, .72, -1.3, -.98, 12.96, 14.4), "joint", T, bevel=.01) 225: y, k = surface(hs, 13.5, 0, -1) 226: P.marks("hatch_code", front(y), 0, text_row(-.44, 13.28, .06, (.3, .14)) + [(-.46, 13.12, .46, 13.15)], C, lean=shear("y", k, 13.5)) 227: solid(f"{P.n}_hatch_handle", prism([(-.18, 13.62), (.18, 13.62), (.18, 13.7), (-.18, 13.7)], y - .07, y + .02, "xz"), "frame", C, .01) 228: # the collar over the hatch and round the neck, in the field colour so the head stands off the accent chest 229: cf = [(-.92, 14.42), (.92, 14.42), (.92, 15.02), (.7, 15.12), (-.7, 15.12), (-.92, 15.02)] 230: cs = [(-1.46, 14.42), (-.3, 14.42), (-.3, 15.12), (-1.0, 15.12), (-1.5, 14.68)] 231: plate(P, "chest_collar", g, cf, cs, T, None) 232: # the belly plate under the hatch 233: bf = [(-1.0, 12.1), (1.0, 12.1), (1.12, 12.96), (-1.12, 12.96)] 234: bs = [(-1.24, 12.96), (-1.06, 12.1), (-.4, 12.1), (-.4, 12.96)] 235: plate(P, "chest_belly", g, bf, bs, T, None) 236: # back plates either side of the backpack on every grade, bigger with weight 237: z0 = {"light": 13.1, "medium": 13.1, "heavy": 12.7}[g] 238: plate(P, "chest_back", g, [(1.0, z0), (1.46, z0), (1.56, 14.5), (1.26, 14.84), (1.0, 14.84)], 239: [(1.04, 14.84), (1.04, z0), (1.26, z0), (1.28, 14.84)], T, T, outward=("+y",)) 240: if g == "heavy": 241: # reactor vents on the chest sides 242: slats = [prism([(-.5, z), (.4, z), (.4, z + .1), (-.5, z + .1)], 1.72, 1.8, "yz") for z in (13.0, 13.22, 13.44, 13.66, 13.88)] 243: P.solid("chest_vent", merge(*slats), "frame", T, T, bevel=.01) 244: 245: 246: def waist(P, J, g): 247: W = J["waist"] 248: wf = [(-1.04, 11.2), (1.04, 11.2), (1.1, 11.9), (-1.1, 11.9)] 249: ws = [(-.72, 11.2), (-.3, 11.2), (-.3, 11.9), (-.82, 11.9)] if g != "heavy" else [(-.72, 11.2), (.72, 11.2), (.72, 11.9), (-.82, 11.9)] 250: plate(P, "waist_front", g, wf, ws, W, None) 251: if g != "light": 252: # a ridge across the abdomen plate 253: P.solid("waist_rib", prism([(-.36, 11.5), (.36, 11.5), (.36, 11.58), (-.36, 11.58)], -.82, -.6, "xz"), "frame", W, bevel=.01) 254: 255: 256: def pelvis(P, J, g): 257: Pv = J["pelvis"] 258: # the crotch block, a V under the belt 259: cf = [(-.56, 10.98), (.56, 10.98), (.56, 10.24), (.2, 9.74), (-.2, 9.74), (-.56, 10.24)] 260: cs = [(-.98, 10.98), (-.36, 10.98), (-.36, 9.74), (-.82, 9.74), (-1.04, 10.24)] 261: plate(P, "pelvis_front", g, cf, cs, Pv, None) 262: # front tassets hang from the belt ahead of the thighs and flare forward at the bottom 263: tf = [(.6, 10.94), (1.38, 10.94), (1.6, 10.76), (1.78, 9.34), (.66, 9.44)] 264: ts = [(-1.08, 10.94), (-.86, 10.94), (-.98, 9.34), (-1.28, 9.34)] 265: plate(P, "pelvis_tasset", g, tf, ts, Pv, Pv, top_o=[(.6, -1.38), (1.84, -1.18), (1.84, -.8), (.6, -.8)]) 266: marks_front(P, "pelvis_code", ts, 10.4, text_row(.78, 10.36, .06, (.16, .08)), Pv, Pv) 267: # side skirts hang from a hinge under the hip pad, flaring out at the bottom 268: P.solid("skirt_hinge", frame_std.box(1.82, 2.12, -.22, .22, 10.44, 10.64), "frame", Pv, Pv, bevel=.015) 269: sf = [(1.98, 10.5), (2.2, 10.5), (2.42, 9.2), (2.2, 9.2)] 270: ss = [(-.52, 10.5), (.8, 10.5), (.88, 9.2), (-.88, 9.2), (-.7, 10.32)] 271: plate(P, "pelvis_skirt", g, sf, ss, Pv, Pv, outward=("+x",)) 272: # the rear skirt, two plates either side of the centre line, longer with weight 273: zr = {"light": 9.9, "medium": 9.7, "heavy": 9.5}[g] 274: rf = [(.08, 10.9), (.96, 10.9), (.9, zr + .2), (.7, zr), (.08, zr)] 275: rs = [(.66, 10.9), (.94, 10.9), (1.08, zr), (.8, zr)] 276: plate(P, "pelvis_rear", g, rf, rs, Pv, Pv, outward=("+y",)) 277: 278: 279: # ---- arms ----------------------------------------------------------------------------------------------- 280: def shoulder(P, J, g): 281: """The pauldron hangs over the shoulder joint, one closed block in the field colour, smaller on the 282: light grade, the shoulder mount pad on its roof. A root cover in front of the shoulder housing fills 283: the step from the chest to the pauldron and turns with the arm, the housing still shows behind it.""" 284: S = lr(J, "shoulder") 285: sf = [(1.98, ROOF), (2.78, ROOF), (3.06, ROOF - .28), (3.22, 13.85), (3.12, 13.65), (2.06, 13.65)] 286: ss = [(-.6, ROOF), (.7, ROOF), (.96, 13.65), (-.98, 13.65), (-.9, ROOF - .38)] 287: f, s = grown(g, sf, ss, k=2.0 if g == "light" else 1.0) 288: tp = plan(f, s, .24, .16) 289: # every grade keeps its roof at the pad height 290: f = [(x, min(z, ROOF)) for x, z in f] 291: s = [(y, min(z, ROOF)) for y, z in s] 292: t = GRADES[g]["t"] 293: pieces, b = banded(f, s, t, None, (14.55, 14.73), top=tp) 294: for bm in pieces: 295: hi = sum(v.co.z for v in bm.verts) / max(len(bm.verts), 1) > 14.73 296: P.solid(f"shoulder_{'cap' if hi else 'body'}", bm, "main", *S) 297: P.solid("shoulder_band", b, "accent", *S, bevel=.02) 298: x, k = surface(f, 14.0, 0, 1) 299: marks_outer(P, "shoulder_code", f, 13.9, text_row(-.5, 13.8, .07, (.22, .12, .16)), *S) 300: for side, j, sx in (("L", S[0], 1), ("R", S[1], -1)): 301: bearing_at(f"shoulder.{side}", (x * sx, .2, 14.16), (sx, 0, -k), j, .5) 302: # a bracket from the shoulder block holds the pauldron 303: P.solid("shoulder_bracket", frame_std.box(2.8, 2.96, -.14, .14, 14.3, 14.56), "frame", *S, bevel=.02) 304: # the root cover: front and top of the housing, stepped in behind the breastplate's outer edge 305: rf = [(1.62, 14.02), (2.0, 14.02), (2.0, 15.06), (1.62, 15.06)] 306: rs = [(-.74, 14.02), (.3, 14.02), (.3, 15.06), (-.46, 15.06), (-.74, 14.78)] 307: P.solid("shoulder_root", shell(rf, rs), "main", *S) 308: 309: 310: def upperarm(P, J, g): 311: UA = lr(J, "upperarm") 312: af = [(2.04, 13.7), (2.64, 13.7), (2.92, 13.42), (2.88, 12.5), (2.08, 12.5)] 313: asd = [(-.5, 13.7), (-.48, 12.5), (.48, 12.5), (.5, 13.7)] 314: plate(P, "upperarm", g, af, asd, *UA, outward=("+x",), ch=(.1, .08), back=True, back_dir="+y") 315: 316: 317: def forearm(P, J, g): 318: """A gauntlet that flares to the wrist and overlaps it, the hand weapon pad proud of its outer 319: face, an elbow guard over the back and outer side of the elbow.""" 320: FA = lr(J, "forearm") 321: ff = [(2.02, 11.56), (2.72, 11.56), (2.98, 11.3), (3.04, 9.8), (1.98, 9.8)] 322: fs = [(-.46, 11.56), (-.56, 9.8), (.56, 9.8), (.46, 11.56)] 323: plate(P, "forearm", g, ff, fs, *FA, outward=("+x",), ch=(.12, .08), back=True, back_dir="+y") 324: # the elbow guard: a cap over the back and outer side of the elbow, riding the forearm 325: ef = [(2.02, 11.5), (2.94, 11.5), (3.02, 12.12), (2.84, 12.34), (2.02, 12.34)] 326: es = [(-.14, 12.34), (.42, 12.34), (.58, 12.0), (.5, 11.5), (-.14, 11.5)] 327: plate(P, "elbow_guard", g, ef, es, *FA, outward=("+x", "+y"), grow=2.0 if g == "light" else 1.0) 328: 329: 330: # ---- legs ----------------------------------------------------------------------------------------------- 331: # The leg is three masses: a short thigh under the skirt, a long shin that is the widest part of the 332: # leg, and a big foot, with a hard knee block on the shin (docs/study-proportions.md). The design is 333: # drawn flat first as front and side outlines, these are its numbers on the striker rig: proportion() 334: # then squeezes the thigh and moves the knee, so the thigh is drawn about twice as tall as it stands. 335: # The heavy grade keeps the medium's outlines and adds pieces: a thigh shield, knee cheeks, a spaced 336: # shin guard, a calf pack and ankle spats. 337: THIGH_F = [(.54, 9.66), (1.92, 9.66), (1.68, 6.9), (1.6, 6.6), (.74, 6.6), (.62, 6.9)] 338: THIGH_FRONT = [(-.3, 9.66), (-1.06, 8.72), (-1.18, 8.2), (-1.1, 7.6), (-1.02, 7.24), (-.84, 7.0), (-.5, 7.0)] 339: THIGH_BACK = [(.48, 7.2), (.76, 8.6), (.6, 9.66)] 340: LEG_GROW = {"light": 1.0, "medium": 1.0, "heavy": 0.0} # the heavy legs add pieces, they do not swell 341: LIGHT_LEG_T = .28 # the light leg plates: thinner than a block, thick enough to read as armour edge on 342: 343: 344: def thigh_outer_x(z): 345: """The thigh's outer face in front view: it narrows from the hip to the knee, mostly on the outside.""" 346: return 1.68 + (z - 6.9) * (1.92 - 1.68) / (9.66 - 6.9) 347: 348: 349: def thigh(P, J, g): 350: """A trapezoid wide at the hip, a front bulge near the top tapering to the knee, a lip at its 351: lower front over the knee block. A back plate over the hamstring on light and medium. An accent 352: holster panel on the outer face, the heavy grade hangs a shield over it on brackets.""" 353: TH = lr(J, "thigh") 354: # the light plates stop under the skirt, where the thick front would hook back over the hip 355: tf = THIGH_F if g != "light" else clip_v(THIGH_F, 0, 9.28) 356: f, s = plate(P, "thigh", g, tf, THIGH_FRONT + THIGH_BACK, *TH, ch=(.14, .08), back=True, split=.12, grow=LEG_GROW[g], 357: t=LIGHT_LEG_T if g == "light" else None, back_block=.3) 358: marks_front(P, "thigh_code", s, 8.3, text_row(.74, 8.32, .08, (.24, .14)) + text_row(.74, 8.16, .05, (.42,)), *TH) 359: if g == "light": 360: return 361: # the outer panel, raised off the outer face 362: za, zb = 7.5, 8.7 363: xa, xb = thigh_outer_x(za), thigh_outer_x(zb) 364: P.solid("thigh_panel", shell([(xa - .06, za), (xa + .1, za), (xb + .1, zb), (xb - .06, zb)], 365: [(-.6, zb), (.4, zb), (.36, za), (-.5, za)]), "accent", *TH, bevel=.02) 366: if g == "heavy": 367: # a shield standing off the outer face on two brackets, wider than the thigh at the knee 368: za, zb = 7.0, 9.6 369: xa, xb = thigh_outer_x(za) + .16, thigh_outer_x(zb) + .16 370: so_f = [(xa, za), (xa + .16, za), (xb + .16, zb), (xb, zb)] 371: so_s = [(-1.0, zb - .4), (-.6, zb), (.66, zb), (.6, za + .3), (.3, za), (-.9, za)] 372: P.solid("thigh_shield", shell(so_f, so_s), "main", *TH) 373: for zc in (7.6, 9.0): 374: xc = thigh_outer_x(zc) 375: P.solid(f"thigh_shield_bracket{zc:.0f}", frame_std.box(xc, xc + .18, -.12, .12, zc - .12, zc + .12), "frame", *TH, bevel=.015) 376: 377: 378: SHIN_F = [(.66, 5.7), (1.76, 5.7), (2.18, 3.95), (2.18, 3.3), (1.96, 2.1), (2.02, 1.68), (.46, 1.68), (.52, 2.1), (.32, 3.3), (.3, 3.95)] 379: SHIN_FRONT = [(-1.1, 5.7), (-1.06, 4.4), (-.96, 2.4), (-1.14, 2.05), (-1.16, 1.68), (-.5, 1.68), (.1, 1.95)] 380: SHIN_BACK = [(.5, 1.95), (.7, 2.6), (1.06, 3.5), (1.12, 4.1), (.8, 5.3), (-.2, 5.7)] 381: SHIN_PANEL = (.96, 1.5, 2.4, 4.5) # the steel strip let into the shin's centre facet 382: KNEE_F = [(.62, 6.82), (1.62, 6.82), (1.86, 6.58), (1.86, 5.8), (1.7, 5.62), (.78, 5.62), (.62, 5.78)] 383: KNEE_S = [(-.62, 6.82), (-1.22, 6.36), (-1.22, 5.92), (-.96, 5.62), (-.45, 5.62), (-.45, 6.82)] 384: KNEE_T = [(.6, -.45), (.6, -.9), (1.24, -1.3), (1.88, -.9), (1.88, -.45)] 385: CALF_VENT = (.98, 1.42, 3.3, 4.2) # a vent let into the back of the calf 386: 387: 388: def shin_plan(f, s): 389: """The shin's plan: a ridge down the front centre, so the front reads as three facets (two angled 390: sides and the flat centre strip where the side profile stands proud of the ridge).""" 391: xs, ys = [p[0] for p in f], [p[0] for p in s] 392: x0, x1, yb = min(xs) - .01, max(xs) + .01, max(ys) + .01 393: return [(x0, yb), (x0, -.72), ((x0 + x1) / 2, -1.2), (x1, -.72), (x1, yb)] 394: 395: 396: def shin(P, J, g): 397: """A hard knee block of its own, square in front with the outboard clip, a wedge in profile, as 398: wide as the shin top. The shin under it: narrower below the knee, widest a little below its 399: middle, a cuff over the ankle, its front in three facets with a steel strip down the centre, the176 more lines not shown.
read_file{"Path":"~/work/sortie/kit/lab/board_sleek.py"}
input
{ "Path": "~/work/sortie/kit/lab/board_sleek.py" }result, 317 lines
Showing lines 1-316 of 316 1: """Estoc (line B), sleek knight: few strong shapes in smooth compound curves, every one ending in a sharp 2: tapered point (docs/study-atelier.md). Knightmare elegance on the atelier's stance. 3: 4: Leaf pauldrons swept back to a rising point, a keeled breastplate whose hem runs to a V, a corseted 5: waist, long blade tassets pointed at the hem, spiked couters, knee guards rising to a point, greaves 6: that sweep to a point over the instep, twin blades swept back from the helm. Thin gold piping on the 7: hems only. Long smooth faces carry long highlights: this direction leans hardest on the sheen. 8: 9: Grades by plate count (plates(J, P, g)): the light a smaller leaf, a bellows waist, short blade tassets, 10: an arming sleeve, one pair of short blades on the helm, the core block. The medium the board's line 11: knight. The heavy a second leaf under the first and a blade under that, a V plate over the lower breast, 12: flank blades, tassets in two layers, blade add-ons over the vambraces, cuisses and greaves, knee blades, 13: two pairs of helm blades. 14: """ 15: import math 16: 17: from knightkit import Sheet, addon, band, by, curve, horn, joint_covers, lames, lin, put, put2, rim, smooth, tent 18: from lib import copy 19: from makers import atelier 20: from makers.atelier import bearing_at, lr 21: from makers.shell import subtract 22: 23: FRONT = lin(-172, -8, 32) 24: breast_r = curve([1.0, 1.34, 1.52, 1.52, 1.42, 1.26, 1.1]) 25: 26: 27: def keel(u, z, grow=0.0, z0=12.1, z1=15.05): 28: r = breast_r(min(max((z - z0) / (z1 - z0), 0), 1)) + grow 29: a = math.radians(u) 30: return (r * 1.08 * math.cos(a), -.15 + r * math.sin(a), z) 31: 32: 33: def chest(P, J, g): 34: T, C = J["torso"], J["cockpit"] 35: H = T if g == "light" else C # the light's cockpit is the core block: its breast does not open 36: bot = lambda u: 12.1 + .7 * (1 - tent(u, -90, 70)) # the hem runs down to a V 37: top = lambda u: 15.05 - .28 * tent(u, -90, 40) - .55 * smooth(abs(u + 90), 56, 80) 38: ridge = lambda u, v: .2 * tent(u, -90, 34) * (1 - smooth(v, .85, 1)) # a keel, crisp on its crest 39: hi = lambda u: 12.9 + 1.2 * (1 - tent(u, -90, 100)) ** 1.6 # the ivory field above a second V, clear of the socket 40: s = Sheet(lambda u, v: keel(u, bot(u) + (top(u) - bot(u)) * v), FRONT, lin(0, 1, 16), .15, disp=ridge, inside=(0, 0, 13.6)) 41: bm = s.bm() 42: up = subtract(copy(bm), _below(hi)) 43: lo = subtract(bm, _above(hi)) 44: # the ivory field above the V is the hatch: it leaves with the pod, so no box is cut in the breast 45: P.solid("hatch", up, "accent", H, bevel=.012) 46: P.solid("breast_lo", lo, "main", T, bevel=.012) 47: rim(P, "breast_pipe", s.edge("v0", out=.01), .045, T) 48: bearing_at("chest", (1.0, -1.55, 14.3), (0, -1, 0), T, .8) 49: back = band((0, .15), 12.3, lambda u: 15.0 - .4 * smooth(u, 55, 80), [1.0, 1.42, 1.56, 1.5, 1.3], lin(14, 82, 10), nv=10, kx=1.04, ky=.92, t=.14) 50: put(P, "backplate", back, "main", T, T) 51: gg = band((0, .05), 14.8, 15.36, [1.14, 1.04, .92], lin(-168, -12, 24), nv=5, kx=1.05, t=.12) 52: put(P, "gorget", gg, "main", T) 53: if g == "light": 54: return 55: g2 = band((0, .05), 15.2, 15.62, [1.0, .94, .86], lin(-164, -16, 22), nv=4, kx=1.05, t=.1) 56: put(P, "gorget2", g2, "main", T) 57: rim(P, "gorget2_pipe", g2.edge("v1", out=.01), .04, T) 58: if g != "heavy": 59: return 60: # the castellan: a V plate over the lower breast, blades down the flanks 61: vb = lambda u: 12.0 + .7 * (1 - tent(u, -90, 70)) 62: vt = lambda u: 12.75 + .5 * (1 - tent(u, -90, 70)) 63: v = Sheet(lambda u, v: keel(u, vb(u) + (vt(u) - vb(u)) * v, .17), lin(-158, -22, 28), lin(0, 1, 5), .14, 64: disp=lambda u, v: .2 * tent(u, -90, 34), inside=(0, 0, 13.0)) 65: put(P, "breast_v", v, "main", T) 66: rim(P, "breast_v_pipe", v.edge("v1", out=.01), .045, T) 67: P.solid("flank_blade", horn([(1.5, -.3, 14.3), (1.62, -.2, 13.6), (1.6, -.1, 12.9), (1.42, 0, 12.2)], .26, n=10, power=1.0, squash=.3, 68: up=(1, 0, 0)), "main", T, T, bevel=0) 69: 70: 71: def _below(h): 72: """A solid under the curve z = h(u) on the chest front (u in plan degrees).""" 73: return _split(h, -1) 74: 75: 76: def _above(h): 77: return _split(h, 1) 78: 79: 80: def _split(h, side): 81: import bmesh 82: bm = bmesh.new() 83: us = lin(-178, -2, 120) 84: far = 30 if side > 0 else -30 85: rings = [] 86: for z in (None, far): 87: ring = [] 88: for u in us: 89: a = math.radians(u) 90: zz = h(u) if z is None else h(u) + far 91: ring += [bm.verts.new((.2 * math.cos(a), -.15 + .2 * math.sin(a), zz)), bm.verts.new((4 * math.cos(a), -.15 + 4 * math.sin(a), zz))] 92: rings.append(ring) 93: n = len(us) 94: A, B = rings 95: for i in range(n - 1): 96: a0, a1, b0, b1 = A[2 * i], A[2 * i + 1], A[2 * i + 2], A[2 * i + 3] 97: c0, c1, d0, d1 = B[2 * i], B[2 * i + 1], B[2 * i + 2], B[2 * i + 3] 98: bm.faces.new((a0, b0, b1, a1)) 99: bm.faces.new((c0, c1, d1, d0)) 100: bm.faces.new((a1, b1, d1, c1)) 101: bm.faces.new((a0, c0, d0, b0)) 102: bm.faces.new((A[0], A[1], B[1], B[0])) 103: bm.faces.new((A[-2], B[-2], B[-1], A[-1])) 104: bmesh.ops.recalc_face_normals(bm, faces=bm.faces) 105: return bm 106: 107: 108: def waist(P, J, g): 109: W = J["waist"] 110: if g == "light": 111: return # a bellows waist (joint_covers) 112: s = band((0, -.1), 11.3, 12.3, [.94, .8, .86, .96], lin(-170, -10, 26), nv=8, kx=1.08, t=.16, 113: disp=lambda u, v: .08 * tent(u, -90, 30)) 114: put(P, "corset", s, "main", W) 115: 116: 117: def pelvis(P, J, g): 118: Pv = J["pelvis"] 119: heavy = g == "heavy" 120: f = band((0, 0), 10.55, 11.25, [1.42, 1.36, 1.2], lin(-172, -8, 30), nv=5, kx=1.06, ky=.84, t=.16, disp=lambda u, v: .1 * tent(u, -90, 30)) 121: put(P, "fauld", f, "main", Pv) 122: P.solid("crotch", atelier.sheet([(-.5, 10.6), (.5, 10.6), (.36, 10.0), (0, 9.5), (-.36, 10.0)], 123: [(-1.04, 10.6), (-.38, 10.6), (-.38, 9.5), (-.9, 9.5)], None), "main", Pv) 124: # a long blade tasset over each thigh, pointed at the hem 125: hem = by(g, lambda u: 9.2 + .7 * (1 - tent(u, -100, 62)), lambda u: 8.35 + .95 * (1 - tent(u, -100, 62)), 126: lambda u: 8.0 + 1.0 * (1 - tent(u, -100, 62))) 127: t = band((1.1, -.12), hem, 10.72, lambda u, v: 1.18 - .22 * v + .06 * math.sin(math.pi * v), lin(-164, -36, 24), nv=10, t=.14, 128: disp=lambda u, v: .07 * tent(u, -100, 22)) 129: put(P, "tasset", t, "main", Pv, Pv) 130: rim(P, "tasset_pipe", t.edge("v0", out=.01), .04, Pv, Pv) 131: if g != "light": 132: # a shorter blade over the long one: the tasset in two layers 133: oh = lambda u: 9.0 + .8 * (1 - tent(u, -100, 56)) 134: t2 = band((1.1, -.12), oh, 10.76, lambda u, v: 1.3 - .22 * v + .06 * math.sin(math.pi * v), lin(-156, -44, 20), nv=8, t=.13, 135: disp=lambda u, v: .07 * tent(u, -100, 22)) 136: put(P, "tasset_over", t2, "main", Pv, Pv) 137: rim(P, "tasset_over_pipe", t2.edge("v0", out=.01), .045, Pv, Pv) 138: if heavy: 139: lames(P, "tasset_side_lame", (1.3, 0), 9.4, 2, .4, .32, 1.12, -.03, lin(-46, 46, 12), Pv, Pv, "main", "main") 140: if g == "light": 141: c = band((0, 0), 10.0, 10.95, [1.36, 1.28, 1.22], lin(10, 88, 12), nv=4, ky=.92, t=.12) 142: put(P, "culet", c, "main", Pv, Pv) 143: return 144: side = band((1.3, 0), lambda u: 9.25 + .5 * (1 - tent(u, 0, 50)), 10.55, [1.12, .86], lin(-50, 50, 12), nv=6, t=.12) 145: put(P, "tasset_side", side, "main", Pv, Pv) 146: c = band((0, 0), lambda u: 9.6 + .5 * smooth(u, 20, 80), 10.95, [1.42, 1.3, 1.22], lin(10, 88, 12), nv=6, ky=.92, t=.14) 147: put(P, "culet", c, "main", Pv, Pv) 148: 149: 150: def shoulder(P, J, g): 151: """A leaf: one shell over the shoulder, blunt in front, drawn back and up into a point. The castellan 152: layers a second leaf under it and a blade under that.""" 153: S = lr(J, "shoulder") 154: # light one small leaf, medium a leaf over a second, heavy one great leaf over a long swept mantle: the 155: # extra mass goes into one gesture, the surfaces stay smooth 156: leaves = by(g, [(.82, 0.0, 2.0, 1.75)], [(1.0, 0.0, 2.0, 1.75), (.9, -.55, 1.4, 1.75)], [(1.12, 0.0, 2.2, 1.75), (1.0, -.5, 1.0, 2.9)]) 157: for i, (k, dz, rise, length) in enumerate(leaves): 158: leaf(P, S, f"pauldron{i}" if i else "pauldron", k, dz, rise, ridge=i == 0, pipe="trim" if i == 0 else "main", length=length) 159: for side, j, sx in (("L", S[0], 1), ("R", S[1], -1)): 160: bearing_at(f"shoulder.{side}", (3.8 * sx, .1, 14.2), (sx, 0, 0), j, .5) 161: 162: 163: def leaf(P, S, name, k, dz, rise, ridge=True, pipe="trim", length=1.75): 164: 165: def width(s): 166: return (1 - abs(s) ** 4) ** .35 if s < 0 else (1 - s ** 1.4) ** .8 # a broad root in front, one point behind 167: 168: def f(s, p): 169: back = max(s, 0.0) 170: w = width(s) 171: y = s * (1.2 if s < 0 else length) * k 172: xc, zc = 2.5 + .7 * k * back ** 2, 14.4 + dz + rise * k * back ** 2 # the point sweeps up and out behind the shoulder, seen from the front 173: a = math.radians(p) 174: c, n = math.cos(a), math.sin(a) 175: return (xc + 1.36 * k * w * math.copysign(abs(c) ** .75, c), .06 + y, zc + .86 * k * w * math.copysign(abs(n) ** .85, n)) 176: # a ridge along the crown from the root into the point 177: sh = Sheet(f, lin(-1.0, .985, 40), lin(116, -96, 28) if ridge else lin(70, -96, 22), .15, 178: disp=(lambda s, p: .16 * width(s) * tent(p, 52, 26)) if ridge else None, inside=(2.5, 0, 14.3 + dz)) 179: put(P, name, sh, "main", *S) 180: if pipe: 181: rim(P, f"{name}_pipe", sh.edge("v1", out=.01), .045, *S, role=pipe) 182: 183: 184: def upperarm(P, J, g): 185: UA = lr(J, "upperarm") 186: if g == "light": 187: return # an arming sleeve (joint_covers) 188: s = band((2.45, 0), 12.4, 13.6, [.56, .54, .5], lin(-150, 150, 26), nv=5, t=.16) 189: put(P, "sleeve", s, "main", *UA) 190: if g == "heavy": 191: lames(P, "sleeve_lame", (2.45, 0), 13.7, 1, .4, .3, .62, 0, lin(-150, 150, 26), *UA, "main", "trim") 192: 193: 194: def forearm(P, J, g): 195: FA = lr(J, "forearm") 196: k = by(g, .7, 1.0, 1.2) 197: s = band((2.5, 0), 9.86, 11.6, [.6, .54, .48, .47], lin(-165, 165, 40), nv=8, kx=.92, t=.16, 198: disp=lambda u, v: .07 * tent(u, -90, 26)) 199: put(P, "vambrace", s, "main", *FA) 200: rim(P, "vambrace_pipe", s.edge("v0", out=.01), .04, *FA) 201: # the couter: a swept spike off the back of the elbow 202: P.solid("couter", horn([(2.5, .2, 12.0), (2.56, .2 + .5 * k, 12.05), (2.62, .2 + 1.0 * k, 12.05 + .25 * k), (2.66, .2 + 1.35 * k, 12.05 + .7 * k)], 203: .42, n=12, power=1.2, squash=.7), "main", *FA, bevel=0) 204: if g != "light": 205: cuff = band((2.5, 0), 9.5, 9.92, [.62, .58], lin(-165, 165, 30), nv=2, kx=.92, t=.1) 206: put(P, "vambrace_cuff", cuff, "main", *FA) 207: if g == "heavy": 208: addon(P, "vambrace_blade", (2.5, 0), lambda v: .66 - .08 * v, lin(-140, -40, 12), 9.95, 11.4, .55, *FA, "main", kx=.92, studs=0, rim_role="main") 209: P.solid("couter_cup", Sheet(_cup((2.5, .1, 11.95)), lin(0, 360, 20), lin(0, 80, 6), .1, wrap=True, inside=(2.5, 0, 11.95)).bm(), "main", *FA, bevel=0) 210: 211: 212: def _cup(c): 213: from knightkit import cap 214: return cap(c, (0, 1, 0), (.55, .55, .4)) 215: 216: 217: def thigh(P, J, g): 218: TH = lr(J, "thigh") 219: s = band((1.16, -.05), 6.75, 9.7, [.74, .8, .86, .86], lin(-162, -18, 24), nv=10, t=.2, disp=lambda u, v: .1 * tent(u, -90, 30)) 220: put(P, "cuisse", s, "main", *TH) 221: if g == "light": 222: return 223: b = band((1.16, -.05), 7.0, 9.5, [.72, .8, .84], lin(28, 152, 16), nv=6, t=.18) 224: put(P, "cuisse_back", b, "main", *TH) 225: if g == "heavy": 226: addon(P, "cuisse_blade", (1.16, -.05), lambda v: .98 + .04 * v, lin(-136, -44, 14), 7.4, 9.5, .8, *TH, "main", studs=0, rim_role="main") 227: 228: 229: GC = (1.2, .02) 230: 231: 232: def shin(P, J, g): 233: SH = lr(J, "shin") 234: heavy = g == "heavy" 235: # the knee guard: a shell over the knee rising to a point above it 236: top = lambda u: 6.55 + 1.0 * tent(u, -90, 46) ** 1.6 237: k = band((1.2, -.12), 5.45, top, lambda u, v: .74 + .08 * math.sin(math.pi * v) - .14 * v * v, lin(-160, -20, 26), nv=10, ky=1.1, t=.16, 238: disp=lambda u, v: .1 * tent(u, -90, 30)) 239: put(P, "knee", k, "main", *SH) 240: rim(P, "knee_pipe", k.edge("v0", out=.01), .04, *SH) 241: # the greave: one smooth sheet, its hem swept down to a point over the instep 242: hem = lambda u: 1.7 - .55 * tent(u, -90, 50) ** 1.5 243: g_ = band(GC, hem, 5.45, [1.08, .86, .68, .64, .66, .6, .55], lin(-176, -4, 34), nv=14, ky=1.14, t=.16, 244: disp=lambda u, v: .09 * tent(u, -90, 30) * (1 - smooth(v, .9, 1))) 245: put(P, "greave", g_, "main", *SH) 246: if heavy: 247: addon(P, "greave_blade", GC, lambda v: [1.14, .96, .8, .74, .74][min(int(v * 4.999), 4)] + .02, lin(-124, -56, 12), 2.2, 5.1, 1.2, *SH, 248: "main", ky=1.14, studs=0, rim_role="main") 249: if g != "light": 250: for nm, sx in (("o", 1), ("i", -1))[:by(g, 0, 1, 2)]: 251: x = 1.2 + sx * .72 252: P.solid(f"knee_blade_{nm}", horn([(x, -.1, 6.0), (x + sx * .12, .2, 6.3), (x + sx * .2, .6, 6.8)], .3, n=10, power=1.0, squash=.3, 253: up=(1, 0, 0)), "main", *SH, bevel=0) 254: if g == "light": 255: rim(P, "greave_pipe", g_.edge("v0", out=.01), .045, *SH) 256: calf = band(GC, 2.0, 5.2, [.9, .76, .66, .7, .72, .6], lin(40, 140, 14), nv=10, ky=1.12, t=.1) 257: put(P, "calf", calf, "main", *SH) 258: return 259: panel = band(GC, lambda u: hem(u) + .25, 5.2, [1.12, .9, .72, .68, .7, .64, .58], lin(-108, -72, 8), nv=14, ky=1.14, t=.08, 260: disp=lambda u, v: .09 * tent(u, -90, 30) * (1 - smooth(v, .9, 1))) 261: put(P, "greave_panel", panel, "accent", *SH) 262: rim(P, "greave_pipe", g_.edge("v0", out=.01), .045, *SH) 263: calf = band(GC, 1.92, 5.3, [1.0, .84, .7, .76, .82, .66], lin(10, 170, 22), nv=12, ky=1.12, t=.14) 264: put(P, "calf", calf, "main", *SH) 265: for side, j, sx in (("L", SH[0], 1), ("R", SH[1], -1)): 266: bearing_at(f"shin.{side}", (1.2 * sx, GC[1] - .85, 4.0), (0, -1, 0), j, .4) 267: 268: 269: def helm_blades(g): 270: def make(P, J): 271: """Twin blades swept back from the temples: short on the light, a second lower pair on the heavy.""" 272: from knightkit import head_layers 273: H = J["head"] 274: pairs = by(g, [(.6, 0)], [(1.0, 0)], [(1.0, 0), (.7, -.32)]) 275: for i, (k, dz) in enumerate(pairs): 276: for s, sx in (("L", 1), ("R", -1)): 277: b = horn([(.5 * sx, -.2, 16.5 + dz), (.62 * sx, -.2 + .4 * k, 16.5 + dz + .25 * k), (.74 * sx, -.2 + .9 * k, 16.5 + dz + .6 * k), 278: (.8 * sx, -.2 + 1.4 * k, 16.5 + dz + 1.1 * k)], .2, n=10, power=1.1, squash=.25, up=(1, 0, 0)) 279: P.solid(f"helm_blade{i}.{s}", b, "trim", H, bevel=0) 280: head_layers(P, J, g) 281: return make 282: 283: 284: def back(P, J, g): 285: """A smooth plate over the pack drawn up to a point between the binders, broader on the castellan.""" 286: from knightkit import back_layers 287: if g == "light": 288: return 289: B = J["backpack"] 290: k = by(g, 0, 0.0, .45) 291: back_layers(P, J, g, "main") 292: s = band((0, 1.5), 12.7 - k * .3, lambda u: 14.4 + 1.0 * tent(u, 90, 34) ** 1.4, [1.2 + k, 1.26 + k, 1.22 + k, 1.1 + k], lin(54, 126, 24), nv=10, 293: kx=.86, t=.12, 294: disp=lambda u, v: .08 * tent(u, 90, 22)) 295: put(P, "pack_plate", s, "accent", B) 296: rim(P, "pack_plate_pipe", s.edge("v0", out=.01), .04, B) 297: 298: 299: def plates(J, P, g="medium"): 300: from knightkit import helm, sabaton, shoulder_root 301: helm(P, J, g, helm_blades(g)) 302: chest(P, J, g) 303: waist(P, J, g) 304: pelvis(P, J, g) 305: shoulder(P, J, g) 306: shoulder_root(P, J) 307: upperarm(P, J, g) 308: forearm(P, J, g) 309: thigh(P, J, g) 310: shin(P, J, g) 311: sab = by(g, ((.55, -3.4),), ((.55, -3.6),), ((.55, -1.4), (-1.2, -3.7))) 312: sabaton(P, J, lames=sab, point=1.0, keel=.08, rims="all") 313: atelier.backpack(P, J, g) 314: back(P, J, g) 315: atelier.binder(P, J, g) 316: joint_covers(P, J, g, style="bellows", fauld="bellows")