experiments/mechs round 5: Seraph assembled from components built to the concept's insets
seraph_parts.py holds one function per component of the sheet (cockpit, missile battery, cannon, emitter, cooling assemblies, hip, knee, foot, chest, pauldron, thigh, shin); part_bench.py builds each alone and renders it from its inset's side; compare.py's components sheet sets each beside its crop. seraph.py lays the biped on the solved skeleton and seats the components (mechlib.seat). mechlib: Geo.hull, prism, tube; Build (a Geo per material). No component yet passes as the same object as its crop; cooling, cannon, thigh and the hip bearing are nearest. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
This commit is contained in:
parent
ab1531332d
commit
71ed5bf4f0
6 changed files with 661 additions and 115 deletions
|
|
@ -8,6 +8,8 @@ with `quick`). Writes, under MECH_OUT/compare/:
|
||||||
and, where the sheet carries a front silhouette icon, that icon against our front view
|
and, where the sheet carries a front silhouette icon, that icon against our front view
|
||||||
<name>_joints.png each joint inset of the sheet beside the same view of the build
|
<name>_joints.png each joint inset of the sheet beside the same view of the build
|
||||||
<name>_trace.png the traced outline drawn on the concept, to check the trace itself
|
<name>_trace.png the traced outline drawn on the concept, to check the trace itself
|
||||||
|
<name>_components.png each component crop of the sheet (concepts.json "components") beside that part built alone
|
||||||
|
(part_bench.py)
|
||||||
<name>_proportions.png the concept's rear and hero views with their marked skeleton (concepts.json) drawn on,
|
<name>_proportions.png the concept's rear and hero views with their marked skeleton (concepts.json) drawn on,
|
||||||
each beside the build's same view with its own joints projected on (<name>_skeleton.json,
|
each beside the build's same view with its own joints projected on (<name>_skeleton.json,
|
||||||
from mechlib.field_views), and skeleton.table() of each pair: joint heights, spans and
|
from mechlib.field_views), and skeleton.table() of each pair: joint heights, spans and
|
||||||
|
|
@ -144,6 +146,24 @@ if rows:
|
||||||
canvas.paste(c, (x, 0))
|
canvas.paste(c, (x, 0))
|
||||||
x += c.width + 8
|
x += c.width + 8
|
||||||
canvas.save(dst / f"{name}_joints.png")
|
canvas.save(dst / f"{name}_joints.png")
|
||||||
|
if "components" in spec and (src / "parts").is_dir():
|
||||||
|
comp = spec["components"]
|
||||||
|
kc = sheet.width / comp["unit"]
|
||||||
|
cells = []
|
||||||
|
for tag, box in comp["crops"].items():
|
||||||
|
path = src / "parts" / f"{tag}.png"
|
||||||
|
if path.exists():
|
||||||
|
cells.append(row([label(fit(sheet.crop(tuple(int(v * kc) for v in box)), 520), "concept: " + comp["labels"][tag]), label(fit(Image.open(path), 520), "ours: " + tag)], 520))
|
||||||
|
per = (len(cells) + 2) // 3
|
||||||
|
cols = [stack(cells[i:i + per]) for i in range(0, len(cells), per)]
|
||||||
|
canvas = Image.new("RGB", (sum(c.width for c in cols) + 8 * (len(cols) - 1), max(c.height for c in cols)), (24, 24, 24))
|
||||||
|
x = 0
|
||||||
|
for c in cols:
|
||||||
|
canvas.paste(c, (x, 0))
|
||||||
|
x += c.width + 8
|
||||||
|
canvas.save(dst / f"{name}_components.png")
|
||||||
|
canvas.resize((2400, max(1, round(canvas.height * 2400 / canvas.width))), Image.LANCZOS).save(dst / f"{name}_components_small.jpg", quality=88)
|
||||||
|
|
||||||
BONES = (("shoulder_l", "shoulder_r"), ("hip_l", "hip_r"), ("waist", "shoulder_l"), ("waist", "shoulder_r"), ("waist", "hip_l"), ("waist", "hip_r")) + tuple(
|
BONES = (("shoulder_l", "shoulder_r"), ("hip_l", "hip_r"), ("waist", "shoulder_l"), ("waist", "shoulder_r"), ("waist", "hip_l"), ("waist", "hip_r")) + tuple(
|
||||||
(a + s, b + s) for s in ("_l", "_r") for a, b in (("shoulder", "elbow"), ("elbow", "wrist"), ("hip", "knee"), ("knee", "ankle")))
|
(a + s, b + s) for s in ("_l", "_r") for a, b in (("shoulder", "elbow"), ("elbow", "wrist"), ("hip", "knee"), ("knee", "ankle")))
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -798,6 +798,97 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
"components": {
|
||||||
|
"unit": 1024,
|
||||||
|
"crops": {
|
||||||
|
"cockpit": [
|
||||||
|
703,
|
||||||
|
453,
|
||||||
|
857,
|
||||||
|
598
|
||||||
|
],
|
||||||
|
"battery": [
|
||||||
|
863,
|
||||||
|
453,
|
||||||
|
1017,
|
||||||
|
598
|
||||||
|
],
|
||||||
|
"cannon": [
|
||||||
|
703,
|
||||||
|
620,
|
||||||
|
857,
|
||||||
|
792
|
||||||
|
],
|
||||||
|
"emitter": [
|
||||||
|
863,
|
||||||
|
620,
|
||||||
|
1017,
|
||||||
|
792
|
||||||
|
],
|
||||||
|
"cooling": [
|
||||||
|
5,
|
||||||
|
815,
|
||||||
|
225,
|
||||||
|
995
|
||||||
|
],
|
||||||
|
"hip": [
|
||||||
|
232,
|
||||||
|
815,
|
||||||
|
428,
|
||||||
|
995
|
||||||
|
],
|
||||||
|
"knee": [
|
||||||
|
436,
|
||||||
|
815,
|
||||||
|
598,
|
||||||
|
995
|
||||||
|
],
|
||||||
|
"foot": [
|
||||||
|
606,
|
||||||
|
815,
|
||||||
|
818,
|
||||||
|
995
|
||||||
|
],
|
||||||
|
"chest": [
|
||||||
|
225,
|
||||||
|
85,
|
||||||
|
490,
|
||||||
|
300
|
||||||
|
],
|
||||||
|
"pauldron": [
|
||||||
|
470,
|
||||||
|
35,
|
||||||
|
660,
|
||||||
|
270
|
||||||
|
],
|
||||||
|
"thigh": [
|
||||||
|
395,
|
||||||
|
265,
|
||||||
|
570,
|
||||||
|
480
|
||||||
|
],
|
||||||
|
"shin": [
|
||||||
|
430,
|
||||||
|
440,
|
||||||
|
610,
|
||||||
|
730
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"labels": {
|
||||||
|
"cockpit": "COCKPIT / SENSOR CLUSTER",
|
||||||
|
"battery": "RIGHT SHOULDER MISSILE BATTERY",
|
||||||
|
"cannon": "RIGHT FOREARM BALLISTIC CANNON",
|
||||||
|
"emitter": "LEFT FOREARM ENERGY EMITTER",
|
||||||
|
"cooling": "REAR COOLING ASSEMBLIES",
|
||||||
|
"hip": "HIP JOINT DETAIL",
|
||||||
|
"knee": "KNEE ASSEMBLY",
|
||||||
|
"foot": "FOOT DETAIL",
|
||||||
|
"chest": "chest plates (hero view)",
|
||||||
|
"pauldron": "left pauldron (hero view)",
|
||||||
|
"thigh": "left thigh plate (hero view)",
|
||||||
|
"shin": "left shin plates (hero view)"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"_doc_skeleton": "skeleton: joints marked by hand on the sheet (pixels of the sheet scaled to skeleton.unit wide), the mech's own left and right; ground is the soles' line, top the figure's highest point in that view. skeleton.py reads it."
|
"_doc_skeleton": "skeleton: joints marked by hand on the sheet (pixels of the sheet scaled to skeleton.unit wide), the mech's own left and right; ground is the soles' line, top the figure's highest point in that view. skeleton.py reads it."
|
||||||
|
|
|
||||||
|
|
@ -493,6 +493,37 @@ class Geo:
|
||||||
self.cylinder(matrix @ Matrix.Translation((r * math.cos(a), r * math.sin(a), 0.5 * (height or size))), size, height or size, 6)
|
self.cylinder(matrix @ Matrix.Translation((r * math.cos(a), r * math.sin(a), 0.5 * (height or size))), size, height or size, 6)
|
||||||
return self
|
return self
|
||||||
|
|
||||||
|
def hull(self, points, matrix=None, mirror=False):
|
||||||
|
"""A faceted convex chunk: the convex hull of points (with their x-mirrors when `mirror`)."""
|
||||||
|
pts = [Vector(q) for q in points]
|
||||||
|
if mirror:
|
||||||
|
pts += [Vector((-q.x, q.y, q.z)) for q in pts if abs(q.x) > 1e-6]
|
||||||
|
verts = [self.bm.verts.new((matrix @ q) if matrix is not None else q) for q in pts]
|
||||||
|
got = bmesh.ops.convex_hull(self.bm, input=verts)
|
||||||
|
junk = list({v for v in got["geom_interior"] + got["geom_unused"] if isinstance(v, bmesh.types.BMVert)})
|
||||||
|
if junk:
|
||||||
|
bmesh.ops.delete(self.bm, geom=junk, context="VERTS")
|
||||||
|
return self
|
||||||
|
|
||||||
|
def prism(self, matrix, outline, depth, chamfer=0.0, scale=1.0):
|
||||||
|
"""A plate or block of any convex outline: counter-clockwise 2D points on the matrix's xy plane, drawn
|
||||||
|
`depth` along its z to the outline scaled by `scale`, the far rim chamfered."""
|
||||||
|
c = min(chamfer, 0.45 * depth)
|
||||||
|
far = [(x * scale, y * scale) for x, y in outline]
|
||||||
|
rings = [(outline, 0.0), (far, depth - c), (_inset(far, c) if c > 1e-6 else far, depth)]
|
||||||
|
loops = [[self.bm.verts.new(matrix @ Vector((q[0], q[1], z))) for q in ring] for ring, z in rings]
|
||||||
|
n = len(outline)
|
||||||
|
self.bm.faces.new(list(reversed(loops[0])))
|
||||||
|
self.bm.faces.new(loops[2])
|
||||||
|
for lower, upper in ((loops[0], loops[1]), (loops[1], loops[2])):
|
||||||
|
for i in range(n):
|
||||||
|
self.bm.faces.new((lower[i], lower[(i + 1) % n], upper[(i + 1) % n], upper[i]))
|
||||||
|
return self
|
||||||
|
|
||||||
|
def tube(self, matrix, r, bore, length, segments=32):
|
||||||
|
"""An open pipe along the matrix's z: wall from `bore` to r, closed at the back by a floor."""
|
||||||
|
return self.lathe(matrix, [(0, 0.04 * length), (bore, 0.04 * length), (bore, length), (r, length), (r, 0), (0, 0)], segments)
|
||||||
|
|
||||||
def truss(self, a, b, up, height, bays, chord=0.04, web=0.014):
|
def truss(self, a, b, up, height, bays, chord=0.04, web=0.014):
|
||||||
"""Two chords `height` apart along `up`, verticals and alternating diagonals."""
|
"""Two chords `height` apart along `up`, verticals and alternating diagonals."""
|
||||||
a, b, up = Vector(a), Vector(b), Vector(up).normalized()
|
a, b, up = Vector(a), Vector(b), Vector(up).normalized()
|
||||||
|
|
@ -2058,3 +2089,60 @@ class Shields:
|
||||||
self.fit.to_object(self.name + ".struts", "gunmetal", self.host)
|
self.fit.to_object(self.name + ".struts", "gunmetal", self.host)
|
||||||
print(f"SHIELDS {self.name}: {self.count} plates, {len(mesh.polygons)} faces")
|
print(f"SHIELDS {self.name}: {self.count} plates, {len(mesh.polygons)} faces")
|
||||||
return obj
|
return obj
|
||||||
|
|
||||||
|
|
||||||
|
def rect(w, h, corner=0.0):
|
||||||
|
"""A rectangle's outline for Geo.prism, counter-clockwise, its corners clipped by `corner` (one or four, from
|
||||||
|
the bottom left)."""
|
||||||
|
cs = [corner] * 4 if isinstance(corner, (int, float)) else list(corner)
|
||||||
|
base = [(-0.5 * w, -0.5 * h), (0.5 * w, -0.5 * h), (0.5 * w, 0.5 * h), (-0.5 * w, 0.5 * h)]
|
||||||
|
out = []
|
||||||
|
for i, k in enumerate(cs):
|
||||||
|
q, a, b = Vector(base[i]), Vector(base[i - 1]), Vector(base[(i + 1) % 4])
|
||||||
|
out += [tuple(q + (a - q).normalized() * k), tuple(q + (b - q).normalized() * k)] if k > 1e-6 else [tuple(q)]
|
||||||
|
return out
|
||||||
|
|
||||||
|
|
||||||
|
class Build:
|
||||||
|
"""One component built from raw geometry on a host: a Geo per material (b["khaki"].hull(...)), made into one
|
||||||
|
object per material by done(). Armor materials are shaded flat with a thin bevel, so every facet's edge
|
||||||
|
catches light as a chamfer; machinery is shaded by angle."""
|
||||||
|
ARMOR = ("khaki", "olive", "olive_light")
|
||||||
|
|
||||||
|
def __init__(self, name, host=None, to_host=None):
|
||||||
|
self.name, self.host, self.to_host, self.geos = name, host, to_host, {}
|
||||||
|
|
||||||
|
def __getitem__(self, mat):
|
||||||
|
if mat not in self.geos:
|
||||||
|
self.geos[mat] = Geo()
|
||||||
|
return self.geos[mat]
|
||||||
|
|
||||||
|
def done(self, bevel=0.014):
|
||||||
|
out = []
|
||||||
|
for mat, geo in self.geos.items():
|
||||||
|
if self.to_host is not None:
|
||||||
|
bmesh.ops.transform(geo.bm, matrix=Matrix(self.to_host), verts=geo.bm.verts[:])
|
||||||
|
obj = geo.to_object(f"{self.name}.{mat}", mat, self.host, 22.0 if mat in self.ARMOR else 38.0)
|
||||||
|
if mat in self.ARMOR and bevel:
|
||||||
|
mod = obj.modifiers.new("Bevel", "BEVEL")
|
||||||
|
mod.width, mod.segments, mod.limit_method, mod.angle_limit = bevel, 1, "ANGLE", math.radians(18)
|
||||||
|
out.append(obj)
|
||||||
|
self.geos = {}
|
||||||
|
return out
|
||||||
|
|
||||||
|
|
||||||
|
def seat(host, origin=(0, 0, 0), outboard=None, side=1, scale=1.0):
|
||||||
|
"""Where a component drawn upright (x right, y forward, z up) goes on a host: Build's to_host. The part's z is
|
||||||
|
laid along whichever of the host's +z or -z points up, its y along the host's +y or -y that points forward,
|
||||||
|
at `origin` in the host's frame. `outboard` is the sign of the part's own x that is its outer side (-1 for a
|
||||||
|
part drawn as a left one), `side` the mech's side it goes on (-1 left): the part is mirrored when they differ."""
|
||||||
|
update()
|
||||||
|
R = host.matrix_world.to_3x3()
|
||||||
|
z = Vector((0, 0, 1 if (R @ Vector((0, 0, 1))).z > 0 else -1))
|
||||||
|
y = Vector((0, 1 if (R @ Vector((0, 1, 0))).y > 0 else -1, 0))
|
||||||
|
x = y.cross(z)
|
||||||
|
if outboard is not None and ((R @ x).x > 0) != (outboard * side > 0):
|
||||||
|
x = -x
|
||||||
|
m = Matrix((x * scale, y * scale, z * scale)).transposed().to_4x4()
|
||||||
|
m.translation = Vector(origin)
|
||||||
|
return m
|
||||||
|
|
|
||||||
32
surfaces/blender/experiments/mechs/part_bench.py
Normal file
32
surfaces/blender/experiments/mechs/part_bench.py
Normal file
|
|
@ -0,0 +1,32 @@
|
||||||
|
"""Builds components alone and renders each from its concept inset's side.
|
||||||
|
MECH_PARTS: comma-separated names from <MECH_SET>_parts.PARTS (default all); MECH_SET: the mech (default seraph).
|
||||||
|
Writes MECH_OUT/<mech>/parts/<name>.png, 800 px, for compare.py's components sheet."""
|
||||||
|
import importlib, math, os, sys, time
|
||||||
|
from pathlib import Path
|
||||||
|
sys.path.insert(0, str(Path(__file__).resolve().parent))
|
||||||
|
import mechlib as M
|
||||||
|
from mathutils import Matrix
|
||||||
|
import bpy
|
||||||
|
|
||||||
|
M.setup()
|
||||||
|
mech = os.environ.get("MECH_SET", "seraph")
|
||||||
|
lib = importlib.import_module(mech + "_parts")
|
||||||
|
out = Path(os.environ["MECH_OUT"]) / mech / "parts"
|
||||||
|
assert out.is_absolute()
|
||||||
|
out.mkdir(parents=True, exist_ok=True)
|
||||||
|
names = [n for n in os.environ.get("MECH_PARTS", "").split(",") if n] or list(lib.PARTS)
|
||||||
|
for name in names:
|
||||||
|
t0 = time.time()
|
||||||
|
for obj in list(bpy.data.objects):
|
||||||
|
bpy.data.objects.remove(obj, do_unlink=True)
|
||||||
|
az, el, margin, pitch = lib.VIEWS[name]
|
||||||
|
host = bpy.data.objects.new("Bench", None)
|
||||||
|
bpy.context.scene.collection.objects.link(host)
|
||||||
|
host.matrix_world = Matrix.Translation((0, 0, getattr(lib, "GROUND", {}).get(name, 5.0))) @ Matrix.Rotation(math.radians(pitch), 4, "X")
|
||||||
|
build = M.Build(name, host)
|
||||||
|
lib.PARTS[name](build)
|
||||||
|
build.done()
|
||||||
|
M.update()
|
||||||
|
rig, cam, centre, radius = M.stage_field(int(os.environ.get("MECH_SAMPLES", "32")))
|
||||||
|
M.shot(rig, cam, radius, az, el, out / f"{name}.png", (800, 800), margin=margin, lens=85.0)
|
||||||
|
print("PART", name, "s", round(time.time() - t0, 1), "faces", sum(len(o.data.polygons) for o in bpy.data.objects if o.type == "MESH"))
|
||||||
|
|
@ -1,13 +1,13 @@
|
||||||
"""SERAPH, round 5: the operator's concept sheet (images/30.webp) laid on its proportion skeleton.
|
"""SERAPH, round 5: the operator's concept sheet (images/30.webp) assembled from its components on its skeleton.
|
||||||
Organic armor as faceted shields (mechlib.Shields): flat faces, crisp edges, a bevelled rim, each standing off the
|
Each component is built to its inset or region of the sheet in seraph_parts.py and checked alone by part_bench.py
|
||||||
frame on struts and lapping its neighbour; the frame (kit girders, dark inner hulls, rams, hoses) shows in the gaps.
|
(compare.py's components sheet sets each beside its crop); this file lays the biped on the solved skeleton and seats
|
||||||
Nothing is a subdivided pod. Joints: hips, a large slew bearing under a hood shield; knees, a yoke and clevis;
|
the components on it. What is not a matched component is said so where it is built."""
|
||||||
ankles, a two-axis cross driven by twin rams down the open calf; elbows, a ribbed sleeve and a barrel hinge."""
|
|
||||||
import math, os, sys, time
|
import math, os, sys, time
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
sys.path.insert(0, str(Path(__file__).resolve().parent))
|
sys.path.insert(0, str(Path(__file__).resolve().parent))
|
||||||
import mechlib as M
|
import mechlib as M
|
||||||
import skeleton
|
import skeleton
|
||||||
|
import seraph_parts as SP
|
||||||
from mathutils import Matrix, Vector
|
from mathutils import Matrix, Vector
|
||||||
import bpy
|
import bpy
|
||||||
|
|
||||||
|
|
@ -29,129 +29,63 @@ CFG["foot"] = (CFG["foot"][0], CFG["foot"][1], CFG["foot"][2] - CROSS)
|
||||||
FOOT, LINKS = CFG["foot"], CFG["links"]
|
FOOT, LINKS = CFG["foot"], CFG["links"]
|
||||||
body = M.biped(CFG)
|
body = M.biped(CFG)
|
||||||
pel, legs, core, arms = body["pelvis"], body["legs"], body["core"], body["arms"]
|
pel, legs, core, arms = body["pelvis"], body["legs"], body["core"], body["arms"]
|
||||||
shields = []
|
|
||||||
DARK = dict(mat="gunmetal", thickness=0.05, chamfer=0.03, standoff=0.0, bolt_r=0.02)
|
|
||||||
|
|
||||||
|
|
||||||
def sh(name, host, **kw):
|
|
||||||
s = M.Shields(name, host, mat=P, **kw)
|
|
||||||
shields.append(s)
|
|
||||||
return s
|
|
||||||
|
|
||||||
|
|
||||||
KITE = [(0, 0.42), (0.1, 0.72), (0.55, 1.0), (0.9, 0.86), (1, 0.58)] # pointed at the -y end, broad shoulders
|
|
||||||
TOMB = [(0, 0.7), (0.08, 0.95), (0.6, 1.0), (0.92, 0.9), (1, 0.66)]
|
|
||||||
LOZ = [(0, 0.5), (0.14, 0.9), (0.5, 1.0), (0.86, 0.9), (1, 0.5)]
|
|
||||||
rows = lambda shape, w: [(v, k * w) for v, k in shape]
|
|
||||||
|
|
||||||
# --- torso: a dark inner hull; a plastron, pectorals, flanks, abdomen lames and a gorget over it; cooling banks behind --
|
|
||||||
CH = CFG["chassis"]["height"]
|
CH = CFG["chassis"]["height"]
|
||||||
inner = M.Plates("Core.hull", core, **DARK)
|
MIR = Matrix.Diagonal((-1.0, 1.0, 1.0, 1.0))
|
||||||
inner.block(F((0, 0, 0.9), UP, FRONT), (2.7, 1.5), CH - 1.0, corner=0.3, top=(0.85, 0.85))
|
|
||||||
inner.block(F((0, 0, 0.0), UP, FRONT), (1.5, 1.2), 1.0, corner=0.25, top=(1.25, 1.1))
|
|
||||||
inner.finish()
|
|
||||||
ts = sh("Torso", core, t=0.09, crown=0.07, standoff=0.14)
|
|
||||||
ts.plate(F((0, 0.98, 0.62 * CH), (0, 1, 0.22), UP), 1.7, rows(KITE, 1.05), bend=3.2, ridge=0.1) # plastron
|
|
||||||
for s in (-1, 1):
|
|
||||||
ts.plate(F((s * 1.22, 0.74, 0.66 * CH), (0.7 * s, 1, 0.25), UP), 1.55, rows(TOMB, 0.62), bend=1.6) # pectoral
|
|
||||||
ts.plate(F((s * 1.5, -0.05, 0.6 * CH), (s, 0, 0.1), UP), 1.7, rows(LOZ, 0.6), bend=1.4) # flank
|
|
||||||
ts.plate(F((s * 0.75, 0.3, CH - 0.08), (0.2 * s, 0.3, 1), FRONT), 1.2, rows(TOMB, 0.5), bend=2.0) # shoulder deck
|
|
||||||
ts.plate(F((s * 0.8, 0.68, 0.3 * CH), (0.6 * s, 1, -0.1), UP), 0.9, rows(LOZ, 0.36), bend=0.9) # rib guard
|
|
||||||
for k in range(3): # abdomen lames, each lapping the next
|
|
||||||
ts.plate(F((0, 0.84 - 0.08 * k, 0.34 * CH - 0.38 * k), (0, 1, -0.12), UP), 0.52, rows(TOMB, 0.62 - 0.06 * k), bend=1.1, standoff=0.06)
|
|
||||||
ts.plate(F((0, 0.72, CH - 0.02), (0, 1, 0.9), UP), 0.7, rows(TOMB, 0.8), bend=1.6, ridge=0.06) # gorget
|
|
||||||
bp = M.Plates("Back", core, mat=P, thickness=0.08, chamfer=0.03, standoff=0.0, bolt_r=0.02)
|
|
||||||
for k, s in enumerate((-1, 1)):
|
|
||||||
bank = bp.block(F((s * 0.85, -0.82, 0.74 * CH), BACK, UP), (1.25, 2.6), 0.6, corner=0.16, top=(0.86, 0.92))
|
|
||||||
M.seat_loose(M.place("heatsink", f"CoolingBank{k}", mat="machine", width=0.84, height=2.0, depth=0.24, fins=18), "back", core, bank["top"][0])
|
|
||||||
for f in ("+x", "-x"):
|
|
||||||
bp.clad(bank[f], k, 0.6)
|
|
||||||
bp.finish()
|
|
||||||
spine = M.Geo()
|
|
||||||
for s in (-1, 1):
|
|
||||||
spine.truss((0.16 * s, -0.9, 0.1), (0.16 * s, -0.9, CH - 0.2), BACK, 0.22, 8, 0.06, 0.02)
|
|
||||||
spine.to_object("Core.spine", "frame", core)
|
|
||||||
|
|
||||||
# --- head: a neck slew, a nod hinge, a faceted helm with a visor ---------------------------------------------------------
|
|
||||||
neck = M.attach(M.place("slew_ring", "Neck", mat="machine", r=0.24, height=0.08, bolts=12, teeth=40), "base", core, "top", 12)
|
|
||||||
nod = M.attach(M.place("yoke", "NeckYoke", ring_r=0.24, drop=0.3, width=0.36, depth=0.3, pin_r=0.05), "base", neck, "top")
|
|
||||||
skull = M.attach(M.place("link", "Skull", length=0.4, width=0.36, depth=0.3, pin_r=0.05), "tongue", nod, "clevis", 8)
|
|
||||||
hm = M.Plates("Helm", skull, mat=P, thickness=0.06, chamfer=0.05, standoff=0.0, bolt_r=0.015)
|
|
||||||
helm = hm.block(F((0, 0.02, -0.3), UP, FRONT), (1.0, 1.15), 0.62, corner=0.26, top=(0.72, 0.7), shift=(0, -0.08), chamfer=0.1)
|
|
||||||
hm.block(F((0, 0.5, -0.02), (0, 1, 0.45), UP), (0.86, 0.3), 0.12, corner=(0.0, 0.0, 0.1, 0.1), top=(0.8, 0.7)) # brow
|
|
||||||
hm.finish()
|
|
||||||
M.Geo().box(T((0, 0.55, -0.2)), (0.6, 0.1, 0.1)).to_object("Visor", "glow", skull)
|
|
||||||
M.Geo().box(T((0, 0.5, -0.2)), (0.76, 0.14, 0.24)).to_object("Visor.frame", "gunmetal", skull)
|
|
||||||
|
|
||||||
# --- pelvis: a dark hull between the legs, a codpiece and a seat shield, a hood over each hip bearing ---------------------
|
def put(name, fn, host, to_host, **kw):
|
||||||
|
build = M.Build(name, host, to_host)
|
||||||
|
fn(build, **kw)
|
||||||
|
if build.to_host is not to_host: # the component mirrors itself (it is drawn for one side)
|
||||||
|
build.to_host = to_host @ build.to_host
|
||||||
|
return build.done()
|
||||||
|
|
||||||
|
|
||||||
|
# --- torso: chest plates, the cockpit in its gorget, the cooling assemblies ----------------------------------------------
|
||||||
|
put("Chest", SP.chest, core, T((0, 0.0, CH - 1.05)))
|
||||||
|
put("Cockpit", SP.cockpit, core, T((0, 0.05, CH + 0.3)) @ Matrix.Scale(0.82, 4))
|
||||||
|
put("Cooling", SP.cooling, core, T((0, -1.0, CH - 1.0)))
|
||||||
|
sh_x, sh_z = 0.5 * CFG["chassis"]["width"] + 0.47 * CFG["chassis"]["side_r"] + CFG["arm"]["yoke"][0], CFG["chassis"]["shoulder"] * CH
|
||||||
|
for side, sx in (("L", -1), ("R", 1)):
|
||||||
|
put(f"Pauldron{side}", SP.pauldron, core, T((sx * (sh_x + 0.15), 0.0, sh_z - 0.25)) @ (MIR if sx > 0 else Matrix.Identity(4)), arm=False)
|
||||||
|
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 facing forward under their lames. The dark hull and the codpiece are not matched components -
|
||||||
leg_x = 0.5 * CFG["pelvis"]["span"] + CFG["hip_h"] + 0.5 * LINKS[0][1]
|
leg_x = 0.5 * CFG["pelvis"]["span"] + CFG["hip_h"] + 0.5 * LINKS[0][1]
|
||||||
ph = M.Plates("Pelvis.hull", pel, **DARK)
|
ph = M.Plates("Pelvis.hull", pel, mat="gunmetal", thickness=0.05, chamfer=0.03, standoff=0.0, bolt_r=0.02)
|
||||||
ph.block(F((0, 0, -1.25), UP, FRONT), (0.8, 1.1), 1.9, corner=0.2, top=(1.5, 1.1))
|
ph.block(F((0, 0, -1.25), UP, FRONT), (0.8, 1.1), 1.9, corner=0.2, top=(1.5, 1.1))
|
||||||
ph.finish()
|
ph.finish()
|
||||||
ps = sh("Hips", pel, t=0.09, crown=0.07, standoff=0.1)
|
cod = M.Shields("Codpiece", pel, mat=P, t=0.09, crown=0.07, standoff=0.1)
|
||||||
ps.plate(F((0, 0.72, -0.3), (0, 1, -0.2), UP), 1.7, rows(KITE, 0.62), bend=1.6, ridge=0.08) # codpiece
|
cod.plate(F((0, 0.78, -0.45), (0, 1, -0.2), UP), 1.7, [(0, 0.26), (0.1, 0.45), (0.55, 0.62), (0.9, 0.54), (1, 0.36)], bend=1.6, ridge=0.08)
|
||||||
ps.plate(F((0, -0.7, -0.2), (0, -1, -0.15), UP), 1.4, rows(KITE, 0.6), bend=1.6)
|
cod.plate(F((0, -0.7, -0.3), (0, -1, -0.15), UP), 1.4, [(0, 0.26), (0.1, 0.45), (0.55, 0.6), (0.9, 0.52), (1, 0.36)], bend=1.6)
|
||||||
for s in (-1, 1):
|
cod.finish()
|
||||||
ps.plate(F((s * (leg_x + 0.25), 0.0, 0.62), (0.45 * s, 0, 1), FRONT), 1.7, rows(LOZ, 0.7), bend=1.0, ridge=0.05) # hood over the bearing
|
for side, sx in (("L", -1), ("R", 1)):
|
||||||
ps.plate(F((s * (leg_x - 0.15), 0.86, 0.2), (0.3 * s, 1, 0.2), UP), 1.0, rows(TOMB, 0.5), bend=1.2) # tasset
|
put(f"Hip{side}", SP.hip, pel, T((sx * (leg_x - 0.25), 0.62, 0.0)) @ (Matrix.Identity(4) if sx > 0 else MIR) @ Matrix.Scale(0.8, 4), shield=False)
|
||||||
|
|
||||||
# --- arms: pauldron shields over the shoulder hinge, upper-arm shields, a sleeve hinge, a vambrace of four on the weapon ---
|
# --- arms: the upper arm's tiers, a sleeve hinge, the cannon on the right forearm and the emitter on the left -------------
|
||||||
for side, arm in arms.items():
|
for side, arm in arms.items():
|
||||||
sx, yk, up, ey, cannon = arm["sx"], arm["yoke"], arm["upper"], arm["elbow"], arm["cannon"]
|
sx, up, ey, fore = arm["sx"], arm["upper"], arm["elbow"], arm["fore"]
|
||||||
lu, lf, out = M.local_dir(yk, UP), M.local_dir(yk, FRONT), Vector((0, 0, 1))
|
|
||||||
c = Vector((0, 0, 0.75))
|
|
||||||
pd = sh(f"Pauldron{side}", yk, t=0.1, crown=0.08, standoff=0.2)
|
|
||||||
pd.plate(F(c + 0.95 * lu + 0.35 * out, lu + 0.55 * out, lf), 2.3, rows(LOZ, 1.3), bend=1.25, ridge=0.1) # the cap, wrapped over the top
|
|
||||||
pd.plate(F(c + 1.05 * lf + 0.05 * lu + 0.1 * out, lf + 0.2 * out, lu), 1.7, rows(KITE, 0.95), bend=2.0) # front
|
|
||||||
pd.plate(F(c - 1.05 * lf + 0.05 * lu + 0.1 * out, -lf + 0.2 * out, lu), 1.7, rows(KITE, 0.95), bend=2.0) # rear
|
|
||||||
pd.plate(F(c - 0.3 * lu + 1.0 * out, out - 0.1 * lu, lu), 1.5, rows(KITE, 0.9), bend=1.4, ridge=0.06) # outer lame
|
|
||||||
U = CFG["arm"]["upper"]
|
U = CFG["arm"]["upper"]
|
||||||
ua = sh(f"UpperArm{side}", up, t=0.08, crown=0.06, standoff=0.12)
|
put(f"UpperArm{side}", SP.upper_arm, up, M.seat(up, (0, 0, -0.35), scale=0.85))
|
||||||
world = up.matrix_world.to_3x3().inverted()
|
|
||||||
for d in (Vector((sx, 0, 0)), Vector((0, 1, 0)), Vector((0, -1, 0))):
|
|
||||||
n = (world @ d).normalized()
|
|
||||||
n.z = 0
|
|
||||||
ua.plate(F(n * 0.52 + Vector((0, 0, 0.3 + 0.5 * U)), n, (0, 0, -1)), U - 0.1, rows(TOMB, 0.4), bend=0.6)
|
|
||||||
M.sleeve_hinge(f"Elbow{side}", ey, 0.2, sleeve=(0.64, 0.64))
|
M.sleeve_hinge(f"Elbow{side}", ey, 0.2, sleeve=(0.64, 0.64))
|
||||||
r, length = CFG["guns"][side]
|
bpy.data.objects.remove(arm["cannon"], do_unlink=True)
|
||||||
q = 3.4 * r
|
face = M.local_sockets(fore)["face"]
|
||||||
vi = M.Plates(f"Vambrace{side}.hull", cannon, **DARK)
|
world = fore.matrix_world.to_3x3()
|
||||||
vi.block(F((0, 0, -0.7), (0, 0, 1), FRONT), (1.5 * q, 1.5 * q), 0.7 + 0.4 * length, corner=0.3 * q, top=(0.9, 0.9))
|
roll = max(range(4), key=lambda q: (world @ (face.to_3x3() @ (Matrix.Rotation(q * math.pi / 2, 3, "Z") @ Vector((0, -1, 0))))).z)
|
||||||
vi.finish()
|
put(f"Weapon{side}", SP.cannon if side == "R" else SP.emitter, fore, face @ Matrix.Rotation(roll * math.pi / 2, 4, "Z") @ Matrix.Rotation(math.pi / 2, 4, "X") @ T((0, -0.3, 0)))
|
||||||
vb = sh(f"Vambrace{side}", cannon, t=0.08, crown=0.06, standoff=0.1)
|
|
||||||
for a in range(4):
|
|
||||||
n = Vector((math.cos(a * math.pi / 2 + math.pi / 4), math.sin(a * math.pi / 2 + math.pi / 4), 0))
|
|
||||||
vb.plate(F(n * 0.98 * q + Vector((0, 0, 0.2 * length - 0.3)), n, (0, 0, -1)), 0.9 + 0.42 * length, rows(TOMB if a % 2 else KITE, 0.72 * q), bend=1.1 * q)
|
|
||||||
if side == "R":
|
|
||||||
M.seat_loose(M.place("rack", "ShoulderBattery", mat="machine", width=0.9, height=0.7, depth=0.6, cols=3), "seat", yk, F(c + 0.1 * lu + 0.75 * lf - 0.2 * out, lf, lu))
|
|
||||||
|
|
||||||
# --- legs: the hip bearing, cuisse shields round the thigh's front, a clevis knee, greave shields, the calf open on rams ---
|
# --- legs: thigh plate, knee assembly, shin plates, foot; twin rams down the open calf ------------------------------------
|
||||||
for side, leg in legs.items():
|
for side, leg in legs.items():
|
||||||
sx = -1 if side == "L" else 1
|
sx = -1 if side == "L" else 1
|
||||||
o = -sx
|
|
||||||
thigh, shin = leg["links"]
|
thigh, shin = leg["links"]
|
||||||
(L, w, d), (L2, w2, d2) = LINKS
|
(L, w, d), (L2, w2, d2) = LINKS
|
||||||
M.slew_bearing(f"Leg{side}.HipBearing", thigh, M.local_sockets(thigh)["hip_r" if sx < 0 else "hip_l"], 0.66, 0.3)
|
put(f"Thigh{side}", SP.thigh, thigh, M.seat(thigh, (0, 0.0, 0.5 * L + 0.1), outboard=-1, side=sx, scale=0.92))
|
||||||
M.clevis_knee(f"Leg{side}.Knee", thigh, 0.42, cheek=0.12, strap=1.0)
|
put(f"Knee{side}", SP.knee, thigh, M.seat(thigh, (0, 0, L), outboard=-1, side=sx), full=False)
|
||||||
cs = sh(f"Cuisse{side}", thigh, t=0.1, crown=0.08, standoff=0.16)
|
put(f"Shin{side}", SP.shin, shin, M.seat(shin, (0, 0.0, 0.5 * L2 + 0.12), scale=0.92))
|
||||||
cs.plate(F((0, 0.74, 0.5 * L + 0.05), (0, 1, 0), (0, 0, -1)), L + 0.5, rows(KITE, 0.86), bend=1.0, ridge=0.1)
|
foot = leg["foot"]
|
||||||
for s in (-1, 1):
|
k = (FOOT[2] + CROSS) / 0.8
|
||||||
cs.plate(F((s * 0.78, 0.0, 0.58 * L + 0.1), (s, 0.15, 0), (0, 0, -1)), L - 0.5, rows(KITE, 0.66), bend=1.0)
|
put(f"Foot{side}", SP.foot, foot, M.seat(foot, (0, 0, -CROSS), outboard=1, side=sx, scale=k))
|
||||||
cs.plate(F((0, -0.62, 0.62 * L), (0, -1, 0), (0, 0, -1)), 0.9, rows(LOZ, 0.42), bend=0.8, standoff=0.08)
|
leg["rams"] = M.recessed_rams(f"Leg{side}", shin, foot, 0.11, 0.2, 0.5, (0.5, 0.0))
|
||||||
gs = sh(f"Greave{side}", shin, t=0.1, crown=0.08, standoff=0.16)
|
|
||||||
gs.plate(F((0, 0.72, 0.5 * L2 + 0.1), (0, 1, 0), (0, 0, 1)), L2 + 0.1, rows(KITE, 0.84), bend=1.0, ridge=0.1)
|
|
||||||
for s in (-1, 1):
|
|
||||||
gs.plate(F((s * 0.76, -0.1, 0.52 * L2), (s, -0.2, 0), (0, 0, 1)), L2 - 0.5, rows(KITE, 0.66), bend=1.0)
|
|
||||||
gs.plate(F((0, 0.84, 0.05), (0, 1, -0.1), (0, 0, -1)), 0.9, rows(LOZ, 0.5), bend=0.7, ridge=0.08, standoff=0.2) # knee cap
|
|
||||||
ft, faces = M.foot_blocks(f"FootBox{side}", leg["foot"], FOOT, toes=((-0.46, -16, 0.0), (0.0, 0, 0.16), (0.46, 16, 0.0)), mat=P, thickness=0.07, chamfer=0.035, standoff=0.0, bolt_r=0.018)
|
|
||||||
for k, face in enumerate(faces):
|
|
||||||
ft.clad(face, k, 0.5, over=0.5)
|
|
||||||
ft.finish()
|
|
||||||
leg["rams"] = M.recessed_rams(f"Leg{side}", shin, leg["foot"], 0.11, 0.2, 0.5, (0.42, 0.08))
|
|
||||||
|
|
||||||
for s in shields:
|
|
||||||
s.finish()
|
|
||||||
M.stencil_text("Mark.breast", core, F((0.45, 1.13, 0.68 * CH), (0, 1, 0.22), UP), "03", 0.3)
|
|
||||||
|
|
||||||
lo, _ = M.bounds()
|
lo, _ = M.bounds()
|
||||||
pel.location.z -= lo.z
|
pel.location.z -= lo.z
|
||||||
|
|
@ -165,8 +99,5 @@ for k, s in enumerate((-1, 1)):
|
||||||
lo, hi = M.bounds()
|
lo, hi = M.bounds()
|
||||||
print("HEIGHT", round(hi.z - lo.z, 2), "WIDTH", round(hi.x - lo.x, 2), "RAMS", {k: len(v["rams"]) for k, v in legs.items()})
|
print("HEIGHT", round(hi.z - lo.z, 2), "WIDTH", round(hi.x - lo.x, 2), "RAMS", {k: len(v["rams"]) for k, v in legs.items()})
|
||||||
M.report_skeleton("seraph", body)
|
M.report_skeleton("seraph", body)
|
||||||
Lg = legs["L"]
|
|
||||||
M.field_views("seraph", t0, hero=(18.0, 3.0), rear=(180.0, 2.0), turns=(90,), samples=64, hero_size=(1600, 1920), joints=M.joint_points(body),
|
M.field_views("seraph", t0, hero=(18.0, 3.0), rear=(180.0, 2.0), turns=(90,), samples=64, hero_size=(1600, 1920), joints=M.joint_points(body),
|
||||||
hero_cam=dict(lens=30.0, eye=1.4, margin=0.7), rear_cam=dict(lens=70.0, eye=2.0, margin=0.76), closeups=(
|
hero_cam=dict(lens=30.0, eye=1.4, margin=0.7), rear_cam=dict(lens=70.0, eye=2.0, margin=0.76))
|
||||||
("hip", Lg["links"][0], (0.6, 0, 0.1), 1.7, 128, 0), ("knee", Lg["links"][0], (0, 0, LINKS[0][0]), 1.6, 62, 2), ("lowerleg", legs["R"]["links"][1], (0, -0.3, 1.4), 1.9, 172, 4),
|
|
||||||
("foot", Lg["foot"], (0, 0.3, 0.2), 1.9, 40, 12), ("elbow", arms["L"]["elbow"], (0, 0, 0.4), 1.5, 70, 0)))
|
|
||||||
|
|
|
||||||
384
surfaces/blender/experiments/mechs/seraph_parts.py
Normal file
384
surfaces/blender/experiments/mechs/seraph_parts.py
Normal file
|
|
@ -0,0 +1,384 @@
|
||||||
|
"""SERAPH's components, each built to its inset or region of the concept sheet (images/30.webp), one function per
|
||||||
|
component. A function takes a mechlib.Build (a Geo per material on a host) and draws in that host's frame, in
|
||||||
|
metres at the sheet's 9.8 m: x to the mech's right, y forward, z up, unless its docstring says otherwise.
|
||||||
|
part_bench.py builds one alone and renders it from the inset's side; compare.py sets it beside the crop.
|
||||||
|
VIEWS: per component (azimuth, elevation, margin, pitch of the part in degrees) for the bench."""
|
||||||
|
import math
|
||||||
|
from mathutils import Matrix, Vector
|
||||||
|
import mechlib as M
|
||||||
|
|
||||||
|
F, T = M.frame_at, Matrix.Translation
|
||||||
|
RX = lambda deg: Matrix.Rotation(math.radians(deg), 4, "X")
|
||||||
|
RY = lambda deg: Matrix.Rotation(math.radians(deg), 4, "Y")
|
||||||
|
RZ = lambda deg: Matrix.Rotation(math.radians(deg), 4, "Z")
|
||||||
|
ALONG_Y = F((0, 0, 0), (0, 1, 0), (0, 0, 1)) # a frame whose z is the host's y: lathes and prisms that run forward
|
||||||
|
|
||||||
|
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": (14, 0, 0.7, 0), "knee": (90, 0, 0.8, 0), "foot": (-40, 9, 0.85, 0),
|
||||||
|
"chest": (18, 3, 0.8, 0), "pauldron": (20, -4, 0.85, 0), "thigh": (18, -5, 0.85, 0), "shin": (18, 0, 0.9, 0)}
|
||||||
|
GROUND = {"foot": 0.8} # the bench stands these on the ground: the origin's height
|
||||||
|
MIRROR = Matrix.Diagonal((-1.0, 1.0, 1.0, 1.0))
|
||||||
|
|
||||||
|
|
||||||
|
def amber():
|
||||||
|
if "amber" not in M.MATS:
|
||||||
|
M.material("amber", (0.02, 0.01, 0.0), 0.0, 0.3, emission=((1.0, 0.3, 0.04), 2.5))
|
||||||
|
return "amber"
|
||||||
|
|
||||||
|
|
||||||
|
def ringed_disc(g, frame, r, t):
|
||||||
|
"""A bearing cap of concentric rings: a rim, a groove, a raised race, a dished face, a hub. z out of the face."""
|
||||||
|
return g.lathe(frame, [(r, 0), (r, 0.5 * t), (0.9 * r, 0.6 * t), (0.86 * r, 0.6 * t), (0.86 * r, 0.42 * t), (0.8 * r, 0.42 * t), (0.8 * r, 0.82 * t), (0.64 * r, 0.82 * t), (0.64 * r, 0.6 * t),
|
||||||
|
(0.54 * r, 0.6 * t), (0.54 * r, t), (0.32 * r, t), (0.32 * r, 0.8 * t), (0.15 * r, 0.8 * t), (0.15 * r, 1.06 * t), (0, 1.06 * t)], 48)
|
||||||
|
|
||||||
|
|
||||||
|
def track(g, a, b, width, n, t, normal):
|
||||||
|
"""A ribbed strip from a to b: n bars across `width`, standing `t` along `normal`. A flexible cover or a belt."""
|
||||||
|
a, b = Vector(a), Vector(b)
|
||||||
|
step = (b - a).length / n
|
||||||
|
for k in range(n):
|
||||||
|
g.box(F(a.lerp(b, (k + 0.5) / n), normal, b - a), (width, 0.6 * step, t))
|
||||||
|
g.box(F((a + b) / 2 - Vector(normal).normalized() * 0.4 * t, normal, b - a), (0.92 * width, (b - a).length, 0.3 * t))
|
||||||
|
return g
|
||||||
|
|
||||||
|
|
||||||
|
def cockpit(b):
|
||||||
|
"""COCKPIT / SENSOR CLUSTER. Origin at the neck. A low, broad faceted helm (a flat crown panel, three brow facets,
|
||||||
|
a facet down each side), under the brow a wide dark face with two slanted amber eyes, a jaw block and cables, set
|
||||||
|
down into the chest's gorget: a plate rising to each shoulder and a front plate carrying a small framed hatch."""
|
||||||
|
k = b["khaki"]
|
||||||
|
k.hull([(0.36, 0.2, 0.78), (0.42, -0.5, 0.74), (0.44, 0.9, 0.36), (0.94, 0.52, 0.3), (1.04, -0.3, 0.32), (0.52, -0.95, 0.34),
|
||||||
|
(0.44, 0.88, 0.16), (0.94, 0.5, 0.1), (1.04, -0.3, 0.0), (0.54, -0.96, 0.0), (0.96, 0.2, 0.0)], mirror=True)
|
||||||
|
k.prism(T((0, -0.14, 0.765)) @ RX(-3.3), [(-0.3, -0.3), (0.3, -0.3), (0.26, 0.3), (-0.26, 0.3)], 0.025, 0.012) # the crown's panel
|
||||||
|
k.prism(F((0, 0.56, 0.585), (0, 0.42, 0.7), (0, 1, 0)), [(-0.3, -0.22), (0.3, -0.22), (0.36, 0.26), (-0.36, 0.26)], 0.02, 0.01) # the brow's centre panel
|
||||||
|
for s in (-1, 1): # cheek guards beside the face
|
||||||
|
k.hull([(s * 0.78, 0.62, 0.2), (s * 1.0, 0.36, 0.16), (s * 0.84, 0.66, -0.4), (s * 1.04, 0.36, -0.44), (s * 1.0, 0.0, 0.1), (s * 1.04, 0.0, -0.44)])
|
||||||
|
d = b["gunmetal"]
|
||||||
|
d.hull([(0.72, 0.6, 0.26), (0.72, 0.1, 0.26), (0.66, 0.7, -0.1), (0.7, 0.1, -0.5), (0.4, 0.78, -0.5)], mirror=True) # the face
|
||||||
|
d.box(T((0, 0.84, -0.26)), (0.26, 0.18, 0.4)) # the jaw block
|
||||||
|
d.box(T((0, 0.9, -0.1)), (0.36, 0.08, 0.07))
|
||||||
|
for s in (-1, 1):
|
||||||
|
d.box(T((s * 0.42, 0.76, -0.32)) @ RZ(-18 * s), (0.24, 0.14, 0.24))
|
||||||
|
for j in range(3):
|
||||||
|
d.rod((s * (0.17 + 0.08 * j), 0.82, -0.08), (s * (0.28 + 0.11 * j), 0.74, -0.5), 0.025, 8)
|
||||||
|
b[amber()].box(T((s * 0.34, 0.69, 0.06)) @ RY(14 * s), (0.3, 0.03, 0.05)) # the eyes
|
||||||
|
for s in (-1, 1): # the gorget: a plate rising to each shoulder
|
||||||
|
k.hull([(s * 1.1, 1.05, -0.46), (s * 2.3, 0.8, 0.1), (s * 2.3, -0.7, 0.3), (s * 1.16, -0.7, 0.1), (s * 1.08, 0.3, -0.2),
|
||||||
|
(s * 1.1, 1.05, -1.1), (s * 2.3, 0.8, -1.1), (s * 2.3, -0.7, -1.1), (s * 1.16, -0.7, -1.1)])
|
||||||
|
k.hull([(1.1, 1.05, -0.5), (0.7, 1.42, -0.62), (1.1, 1.05, -1.2), (0.7, 1.5, -1.2), (1.1, 0.6, -0.5)], mirror=True) # the front plate
|
||||||
|
hatch = F((0, 1.455, -0.86), (0, 1, 0.14), (0, 0, 1))
|
||||||
|
k.prism(hatch, M.rect(0.44, 0.38, 0.03), 0.035, 0.012)
|
||||||
|
d.box(hatch @ T((0, 0.09, 0.04)), (0.26, 0.07, 0.03))
|
||||||
|
k.prism(hatch @ T((0, -0.03, 0.035)), M.rect(0.32, 0.15, 0.02), 0.02, 0.008)
|
||||||
|
|
||||||
|
|
||||||
|
def battery(b):
|
||||||
|
"""RIGHT SHOULDER MISSILE BATTERY. Origin at the middle of the mouth, firing along y. A thick-walled cowl, an
|
||||||
|
arch of five slabs from the upper left over the top and down the right, a floor slab, a cap slab lapped over
|
||||||
|
the top; in its dark mouth six launch tubes, two columns of three, the right column a little lower, each a
|
||||||
|
pipe with a bright lip and a missile nose; on the left a flat door plate swung part open."""
|
||||||
|
b.to_host = MIRROR # drawn with the arch on the right; on the sheet it is inboard
|
||||||
|
k, d = b["khaki"], b["gunmetal"]
|
||||||
|
R, depth, t = 0.9, 1.4, 0.2
|
||||||
|
angles = [150, 110, 70, 30, -10, -50]
|
||||||
|
for a0, a1 in zip(angles, angles[1:]):
|
||||||
|
p0, p1 = (Vector((math.cos(math.radians(a)) * R * 1.05, 0, math.sin(math.radians(a)) * R)) for a in (a0, a1))
|
||||||
|
mid, chord = (p0 + p1) / 2, (p1 - p0)
|
||||||
|
k.prism(T(mid + Vector((0, -0.5 * depth, 0))) @ RY(-math.degrees(math.atan2(chord.z, chord.x))) @ RX(-90) @ T((0, 0, 0)), M.rect(chord.length + 0.1, t, 0.03), depth, 0.03)
|
||||||
|
k.prism(T((0.0, -0.5 * depth, -0.8)) @ RX(-90), M.rect(1.6, t, 0.03), depth, 0.03) # the floor
|
||||||
|
k.prism(T((-0.2, -0.5 * depth - 0.1, 0.98)) @ RY(5) @ RX(-90), M.rect(2.0, 0.14, 0.03), depth * 0.86, 0.03) # the cap, lapped over the top
|
||||||
|
d.box(T((0.05, -0.1, 0.02)), (1.5, 0.9, 1.5)) # the liner
|
||||||
|
for col, x in enumerate((-0.16, 0.3)):
|
||||||
|
for row in range(3):
|
||||||
|
z = 0.42 - 0.43 * row - 0.1 * col
|
||||||
|
at = T((x, -0.45, z)) @ ALONG_Y
|
||||||
|
d.tube(at, 0.185, 0.155, 0.85)
|
||||||
|
b["machine"].lathe(at @ T((0, 0, 0.84)), [(0.158, 0), (0.158, 0.025), (0.192, 0.025), (0.192, 0)], 32)
|
||||||
|
b["rubber"].lathe(at @ T((0, 0, 0.05)), [(0.14, 0), (0.14, 0.2), (0.06, 0.36), (0, 0.38)], 20)
|
||||||
|
b[amber()].cylinder(at @ T((0, 0, 0.44)), 0.035, 0.02, 12)
|
||||||
|
door = T((-1.0, 0.5 * depth - 0.1, -0.02)) @ RZ(-24) # hinged on its left edge
|
||||||
|
k.prism(door @ T((0.36, 0, 0)) @ RX(-90), M.rect(0.72, 1.2, 0.06), 0.1, 0.03)
|
||||||
|
d.rod(door @ Vector((0, 0.02, -0.5)), door @ Vector((0, 0.02, 0.5)), 0.04, 10)
|
||||||
|
k.hull([(-0.95, -0.6, 0.55), (-0.95, 0.3, 0.5), (-0.95, 0.3, -0.75), (-0.95, -0.6, -0.75), (-0.8, -0.6, 0.6), (-0.8, 0.3, 0.55), (-0.8, 0.3, -0.75), (-0.8, -0.6, -0.75)]) # the left wall, behind the door
|
||||||
|
|
||||||
|
|
||||||
|
def cannon(b):
|
||||||
|
"""RIGHT FOREARM BALLISTIC CANNON. Origin at the breech, the bore along y. One turned barrel: a jacket with
|
||||||
|
raised bands and six rails, a collar, a necked sleeve with four lugs, a flared muzzle shroud with a stepped
|
||||||
|
mouth and an inner liner; over the breech the vambrace's two plates and a clamp."""
|
||||||
|
R, L = 0.32, 3.4
|
||||||
|
d = b["gunmetal"]
|
||||||
|
d.lathe(ALONG_Y, [(0.9 * R, 0), (0.9 * R, 0.05 * L), (R, 0.06 * L), (R, 0.5 * L), (1.12 * R, 0.51 * L), (1.12 * R, 0.56 * L), (0.95 * R, 0.575 * L), (0.95 * R, 0.77 * L), (1.1 * R, 0.79 * L),
|
||||||
|
(1.18 * R, 0.83 * L), (1.18 * R, 0.965 * L), (1.1 * R, L), (0.8 * R, L), (0.8 * R, 0.975 * L), (0.66 * R, 0.975 * L), (0.66 * R, 0.93 * L), (0.52 * R, 0.93 * L), (0.52 * R, 0.4 * L), (0, 0.4 * L)], 48)
|
||||||
|
for z in (0.16, 0.3, 0.44, 0.66, 0.88):
|
||||||
|
d.lathe(ALONG_Y @ T((0, 0, z * L)), [((1.19 if z > 0.8 else 0.96 if z > 0.6 else 1.0) * R, 0), ((1.225 if z > 0.8 else 0.99 if z > 0.6 else 1.03) * R, 0.004 * L), ((1.225 if z > 0.8 else 0.99 if z > 0.6 else 1.03) * R, 0.016 * L), ((1.19 if z > 0.8 else 0.96 if z > 0.6 else 1.0) * R, 0.02 * L)], 48)
|
||||||
|
for j in range(6):
|
||||||
|
a = math.radians(60 * j + 30)
|
||||||
|
d.box(Matrix.Rotation(a, 4, "Y") @ T((1.01 * R, 0.29 * L, 0)), (0.035, 0.36 * L, 0.09))
|
||||||
|
for j in range(4):
|
||||||
|
a = math.radians(90 * j + 45)
|
||||||
|
d.box(Matrix.Rotation(a, 4, "Y") @ T((0.98 * R, 0.7 * L, 0)), (0.07, 0.07 * L, 0.14))
|
||||||
|
for j in range(8):
|
||||||
|
a = math.radians(45 * j)
|
||||||
|
d.box(Matrix.Rotation(a, 4, "Y") @ T((1.19 * R, 0.9 * L, 0)), (0.03, 0.05 * L, 0.1))
|
||||||
|
k = b["khaki"]
|
||||||
|
k.hull([(0.52, -0.5, 0.36), (0.46, 0.7, 0.46), (0.3, -0.5, 0.72), (0.26, 0.6, 0.76), (0.58, -0.5, -0.1), (0.52, 0.55, -0.02)], mirror=True) # the vambrace over the breech
|
||||||
|
k.hull([(0.32, 0.5, 0.52), (0.28, 1.0, 0.46), (0.18, 0.5, 0.7), (0.16, 0.95, 0.6), (0.36, 0.6, 0.3), (0.32, 1.0, 0.34)], mirror=True) # its beak
|
||||||
|
d.box(T((0, 1.0, 0.44)), (0.3, 0.06, 0.14))
|
||||||
|
d.box(T((0, 0.8, 0.3)), (0.3, 0.4, 0.14))
|
||||||
|
|
||||||
|
|
||||||
|
def emitter(b):
|
||||||
|
"""LEFT FOREARM ENERGY EMITTER. Origin at the back, firing along y. A long box of slab walls with clipped
|
||||||
|
corners, open at the mouth; each side a framed recess of nine louvres; the mouth two nested frames stepping
|
||||||
|
in to a stack of emitter cells; a rail along the top, a clamp block at the back, a chin frame under the mouth."""
|
||||||
|
k, d = b["khaki"], b["gunmetal"]
|
||||||
|
L, w, h, t = 2.5, 1.0, 1.25, 0.09
|
||||||
|
for s in (-1, 1):
|
||||||
|
d.prism(T((s * (0.5 * w - t), 0, 0)) @ F((0, 0, 0), (s, 0, 0), (0, 0, 1)), M.rect(L, h - 0.24, 0.0), t, 0.02) if False else None
|
||||||
|
d.box(T((s * (0.5 * w - 0.5 * t), 0.5 * L, 0)), (t, L, h - 0.26)) # side walls
|
||||||
|
d.box(T((0, 0.5 * L, s * (0.5 * h - 0.5 * t))), (w - 0.26, L, t)) # roof and floor
|
||||||
|
for u in (-1, 1): # the clipped corners
|
||||||
|
d.box(T((s * (0.5 * w - 0.09), 0.5 * L, u * (0.5 * h - 0.09))) @ RY(45 * s * u), (0.2, L, t))
|
||||||
|
side = F((s * 0.5 * w, 0.48 * L, 0.0), (s, 0, 0), (0, 0, 1)) # x along the box, y up
|
||||||
|
for y in (-0.36, 0.36):
|
||||||
|
d.box(side @ T((0, y, 0.03)), (0.62 * L, 0.07, 0.06))
|
||||||
|
for x in (-0.31 * L, 0.31 * L):
|
||||||
|
d.box(side @ T((x, 0, 0.03)), (0.07, 0.79, 0.06))
|
||||||
|
for j in range(9):
|
||||||
|
d.box(side @ T((0, -0.28 + 0.07 * j, 0.012)) @ RX(25), (0.58 * L, 0.05, 0.02))
|
||||||
|
d.box(T((0, 0.02, 0)), (w - 0.2, 0.04, h - 0.2)) # the back
|
||||||
|
for i, (fw, fh, y, ft) in enumerate(((w + 0.14, h + 0.14, L - 0.12, 0.16), (w - 0.28, h - 0.3, L - 0.26, 0.1))): # the mouth's frames
|
||||||
|
for s in (-1, 1):
|
||||||
|
d.box(T((s * (0.5 * fw - 0.5 * ft), y, 0)), (ft, 0.24, fh))
|
||||||
|
d.box(T((0, y, s * (0.5 * fh - 0.5 * ft))), (fw, 0.24, ft))
|
||||||
|
for j in range(5):
|
||||||
|
d.box(T((0, L - 0.5, -0.3 + 0.15 * j)), (0.34, 0.2, 0.09))
|
||||||
|
b["glow_blue"].box(T((0, L - 0.39, -0.3 + 0.15 * j)), (0.2, 0.02, 0.03))
|
||||||
|
d.box(T((0, L - 0.5, 0)), (0.12, 0.3, 0.86))
|
||||||
|
d.box(T((0, 0.55 * L, 0.5 * h + 0.06)), (0.3, 0.8 * L, 0.12)) # the top rail
|
||||||
|
for y in (0.3, 0.55, 0.8):
|
||||||
|
d.box(T((0, y * L, 0.5 * h + 0.14)), (0.4, 0.12, 0.08))
|
||||||
|
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
|
||||||
|
|
||||||
|
|
||||||
|
def cooling(b):
|
||||||
|
"""REAR COOLING ASSEMBLIES. Origin between the two units at mid-height; they face -y, toed out 8 degrees. Each a
|
||||||
|
tall housing open to the rear: two thick side walls with a clipped outer rear edge and a row of bolts, a
|
||||||
|
stepped cap of two blocks, a clipped foot; in the recess a dark back plate, eleven vertical fins, two
|
||||||
|
riser pipes and cross wires. A ribbed spine stands between them."""
|
||||||
|
k, d = b["khaki"], b["gunmetal"]
|
||||||
|
Hh, w, dep = 3.1, 1.2, 0.8
|
||||||
|
for s in (-1, 1):
|
||||||
|
at = T((s * 0.86, 0, 0)) @ RZ(8 * s)
|
||||||
|
for u in (-1, 1):
|
||||||
|
xo, xi = u * 0.5 * w, u * (0.5 * w - 0.24)
|
||||||
|
pts = [(xi, -0.5 * dep), (xi, 0.5 * dep), (xo, 0.5 * dep), (xo, -0.5 * dep + 0.12), (xo - u * 0.1, -0.5 * dep)]
|
||||||
|
k.hull([(x, y, z) for x, y in pts for z in (-0.5 * Hh, 0.5 * Hh)], at)
|
||||||
|
for j in range(9):
|
||||||
|
d.cylinder(at @ T((u * (0.5 * w - 0.14), -0.5 * dep - 0.01, -0.5 * Hh + 0.2 + j * (Hh - 0.4) / 8)) @ RX(90), 0.03, 0.03, 6)
|
||||||
|
k.hull([(x, y, z) for x in (-0.5 * w, 0.5 * w) for y in (-0.5 * dep, 0.5 * dep) for z in (0.5 * Hh,)] + [(x, y, 0.5 * Hh + 0.3) for x in (-0.5 * w + 0.1, 0.5 * w - 0.1) for y in (-0.5 * dep + 0.1, 0.5 * dep)], at)
|
||||||
|
k.hull([(x, y, 0.5 * Hh + 0.3) for x in (-0.32, 0.32) for y in (-0.2, 0.3)] + [(x, y, 0.5 * Hh + 0.52) for x in (-0.26, 0.26) for y in (-0.14, 0.26)], at)
|
||||||
|
k.hull([(x, y, -0.5 * Hh) for x in (-0.5 * w, 0.5 * w) for y in (-0.5 * dep, 0.5 * dep)] + [(x, y, -0.5 * Hh - 0.34) for x in (-0.5 * w + 0.22, 0.5 * w - 0.22) for y in (-0.5 * dep + 0.2, 0.5 * dep)], at)
|
||||||
|
d.box(at @ T((0, 0.2, 0)), (w - 0.4, 0.1, Hh))
|
||||||
|
for j in range(11):
|
||||||
|
d.box(at @ T((-0.3 + 0.06 * j, -0.05, 0)), (0.016, 0.4, Hh - 0.1))
|
||||||
|
for x in (-0.14, 0.14):
|
||||||
|
b["machine"].rod(at @ Vector((x, -0.3, -0.5 * Hh + 0.05)), at @ Vector((x, -0.3, 0.5 * Hh - 0.05)), 0.035, 10)
|
||||||
|
for j in range(14):
|
||||||
|
z = -0.5 * Hh + 0.15 + j * (Hh - 0.3) / 13
|
||||||
|
d.rod(at @ Vector((-0.36, -0.27, z)), at @ Vector((0.36, -0.27, z)), 0.01, 6)
|
||||||
|
track(d, (0, -0.1, -1.4), (0, -0.1, 1.5), 0.36, 12, 0.3, (0, -1, 0))
|
||||||
|
for s in (-1, 1):
|
||||||
|
d.box(T((s * 0.2, 0.1, 0.0)), (0.06, 0.4, 3.0))
|
||||||
|
|
||||||
|
|
||||||
|
def hip(b, shield=True):
|
||||||
|
"""HIP JOINT. Origin at the bearing's centre; its axis is y, toward the front. One ringed bearing (a dark rim, a
|
||||||
|
bright race, a dished face, a notched hub) in a housing ribbed round its upper half; the thigh's shield laps its
|
||||||
|
outer side, a big clipped plate with a small plate on its outer edge and a second plate below; over it the
|
||||||
|
pelvis's lames, three blocks in a row, and the codpiece's edge inboard. Drawn as the left hip: outboard is -x."""
|
||||||
|
b.to_host = MIRROR # drawn as the left hip; the sheet shows the right
|
||||||
|
k, d = b["khaki"], b["gunmetal"]
|
||||||
|
face = ALONG_Y
|
||||||
|
d.lathe(face @ T((0, 0, -0.5)), [(0.74, 0), (0.74, 0.42), (0.66, 0.5), (0.5, 0.5)], 48)
|
||||||
|
ringed_disc(b["gunmetal"], face, 0.56, 0.2)
|
||||||
|
d.box(T((0.02, 0.22, 0.0)) @ RY(35), (0.05, 0.03, 0.14))
|
||||||
|
for j in range(11): # the ribbed housing
|
||||||
|
a = math.radians(-10 + 20 * j)
|
||||||
|
d.box(RY(-math.degrees(a)) @ T((0.84, -0.22, 0)), (0.3, 0.6, 0.2))
|
||||||
|
d.lathe(face @ T((0, 0, -0.6)), [(0.9, 0), (0.9, 0.5), (0.6, 0.5)], 40)
|
||||||
|
if not shield:
|
||||||
|
return hip_lames(k)
|
||||||
|
plate = F((-1.25, 0.3, -0.35), (-0.3, 1, 0.05), (0, 0, 1)) # the thigh's shield
|
||||||
|
k.prism(plate, [(0.9, -1.25), (0.62, 0.3), (0.2, 0.95), (-0.55, 1.05), (-0.9, 0.5), (-0.9, -1.25)][::-1], 0.16, 0.05, 0.94)
|
||||||
|
k.prism(plate @ T((0.72, 0.5, -0.02)), [(0.26, -0.5), (0.26, 0.2), (0.0, 0.52), (-0.22, 0.4), (-0.22, -0.5)][::-1], 0.26, 0.04, 0.9) # the small plate on its outer edge
|
||||||
|
k.prism(F((0.15, 0.28, -1.15), (0.25, 1, 0), (0, 0, 1)), [(-0.5, -0.5), (0.4, -0.5), (0.5, 0.3), (0.1, 0.55), (-0.5, 0.2)], 0.14, 0.04, 0.94) # the plate below
|
||||||
|
hip_lames(k)
|
||||||
|
|
||||||
|
|
||||||
|
def hip_lames(k):
|
||||||
|
for j, (x, w) in enumerate(((-0.55, 0.6), (0.08, 0.62), (0.7, 0.5))): # the pelvis's lames
|
||||||
|
k.hull([(x - 0.5 * w, -0.3, 0.92), (x + 0.5 * w, -0.3, 0.92), (x - 0.5 * w, 0.3, 0.86 - 0.04 * j), (x + 0.5 * w, 0.3, 0.86 - 0.04 * j),
|
||||||
|
(x - 0.5 * w + 0.04, -0.3, 1.3), (x + 0.5 * w - 0.04, -0.3, 1.3), (x - 0.5 * w + 0.04, 0.22, 1.28), (x + 0.5 * w - 0.04, 0.22, 1.28)])
|
||||||
|
k.hull([(0.95, 0.5, 0.75), (1.4, 0.4, 0.8), (0.95, 0.6, -1.0), (1.3, 0.5, -1.2), (0.95, 0.1, 0.75), (1.4, 0.1, -1.0)]) # the codpiece's edge
|
||||||
|
|
||||||
|
|
||||||
|
def knee(b, full=True):
|
||||||
|
"""KNEE ASSEMBLY, the left leg from its outer side: y forward, z up, the outer face -x; origin on the knee's
|
||||||
|
axis. A ringed trunnion cap on the axis; from above, the thigh's plate ending short of it; in front and below,
|
||||||
|
the knee cap, a bulged shield of five facets with a small roundel low on it; behind it two lapped plates on
|
||||||
|
the shin's side; below, the shin's front plate; a ribbed strip down the back of the calf; the girder inside."""
|
||||||
|
k, d = b["khaki"], b["gunmetal"]
|
||||||
|
out = lambda y, z, x=0.0: F((-0.5 - x, y, z), (-1, 0, 0), (0, 0, 1)) # a frame on the outer face: x is -y (back), y up
|
||||||
|
if full:
|
||||||
|
d.box(T((0, -0.05, -0.4)), (0.8, 0.7, 3.6)) # the girder
|
||||||
|
ringed_disc(b["gunmetal"], out(0.22, 0.5, 0.12), 0.4, 0.2)
|
||||||
|
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)
|
||||||
|
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:
|
||||||
|
k.hull([(-0.52, 0.2, -0.9), (-0.52, 0.66, -0.95), (-0.5, 0.26, -2.1), (-0.5, 0.74, -2.1), (0.0, 0.5, -0.9), (0.0, 0.86, -1.0), (0.0, 0.92, -2.1), (0.0, 0.3, -2.1)]) # the shin's front plate
|
||||||
|
track(d, (-0.3, -0.45, -0.95), (-0.3, -0.5, -2.1), 0.36, 9, 0.14, (0, -1, 0))
|
||||||
|
|
||||||
|
|
||||||
|
def foot(b):
|
||||||
|
"""FOOT, the right foot: outer is +x; origin at the ankle pin, the sole at z = -0.8. A ringed wheel on the
|
||||||
|
ankle's outer side and a smaller one inboard; a ribbed strip down the instep between two pairs of cheek
|
||||||
|
blocks; two big toe wedges, each a body, a cap plate and a low tip, splayed; a third short toe outboard; a
|
||||||
|
heel block; over it the shin's cuff, one broad clipped block with three tabs hung under it."""
|
||||||
|
k, d = b["khaki"], b["gunmetal"]
|
||||||
|
ringed_disc(b["gunmetal"], F((0.66, -0.05, -0.22), (1, 0, 0), (0, 0, 1)), 0.42, 0.22)
|
||||||
|
ringed_disc(b["gunmetal"], F((-0.6, 0.28, -0.2), (-1, 0.2, 0), (0, 0, 1)), 0.3, 0.16)
|
||||||
|
d.box(T((0, 0, -0.2)), (1.2, 0.6, 0.7)) # the ankle's block
|
||||||
|
track(d, (0, 0.34, 0.25), (0, 1.0, -0.5), 0.34, 9, 0.12, (0, 0.75, 0.66))
|
||||||
|
for s in (-1, 1):
|
||||||
|
for j, (y, z, q) in enumerate(((0.36, 0.0, 0.34), (0.56, -0.3, 0.3))): # cheek blocks beside the strip
|
||||||
|
k.hull([(s * 0.22, y - 0.5 * q, z - 0.5 * q), (s * 0.22, y + 0.5 * q, z - 0.5 * q), (s * 0.22, y - 0.5 * q, z + 0.5 * q), (s * 0.22, y + 0.4 * q, z + 0.5 * q),
|
||||||
|
(s * 0.56, y - 0.5 * q, z - 0.5 * q), (s * 0.56, y + 0.5 * q, z - 0.5 * q), (s * 0.52, y - 0.5 * q, z + 0.5 * q), (s * 0.52, y + 0.4 * q, z + 0.44 * q)])
|
||||||
|
toe = T((s * 0.36, 0.72, -0.8)) @ RZ(-13 * s) # a toe wedge: origin at its heel on the ground
|
||||||
|
k.hull([(-0.34, 0, 0), (0.34, 0, 0), (-0.34, 0.8, 0), (0.34, 0.8, 0), (-0.3, 0.0, 0.64), (0.3, 0.0, 0.64), (-0.27, 0.72, 0.4), (0.27, 0.72, 0.4)], toe)
|
||||||
|
k.prism(toe @ F((0, 0.36, 0.52), (0, 0.33, 1), (0, 1, 0)), M.rect(0.46, 0.56, 0.05), 0.05, 0.02)
|
||||||
|
k.hull([(-0.31, 0.82, 0), (0.31, 0.82, 0), (-0.27, 1.14, 0), (0.27, 1.14, 0), (-0.27, 0.82, 0.34), (0.27, 0.82, 0.34), (-0.23, 1.1, 0.2), (0.23, 1.1, 0.2)], toe)
|
||||||
|
side = T((0.72, 0.42, -0.8)) @ RZ(-38)
|
||||||
|
k.hull([(-0.2, 0, 0), (0.2, 0, 0), (-0.2, 0.6, 0), (0.2, 0.6, 0), (-0.17, 0, 0.36), (0.17, 0, 0.36), (-0.15, 0.52, 0.18), (0.15, 0.52, 0.18)], side)
|
||||||
|
k.hull([(-0.36, -0.9, -0.8), (0.36, -0.9, -0.8), (-0.42, -0.3, -0.8), (0.42, -0.3, -0.8), (-0.3, -0.8, -0.5), (0.3, -0.8, -0.5), (-0.36, -0.3, -0.3), (0.36, -0.3, -0.3)]) # the heel
|
||||||
|
k.hull([(-0.7, -0.5, 0.2), (0.7, -0.5, 0.2), (-0.74, 0.46, 0.3), (0.74, 0.46, 0.3), (-0.64, -0.5, 0.7), (0.64, -0.5, 0.7), (-0.68, 0.4, 0.7), (0.68, 0.4, 0.7), (-0.5, 0.6, 0.45), (0.5, 0.6, 0.45)]) # the cuff
|
||||||
|
k.hull([(-0.56, -0.45, 0.7), (0.56, -0.45, 0.7), (-0.58, 0.34, 0.7), (0.58, 0.34, 0.7), (-0.5, -0.4, 1.4), (0.5, -0.4, 1.4), (-0.52, 0.3, 1.4), (0.52, 0.3, 1.4)])
|
||||||
|
for x, y, rot in ((0.0, 0.56, 0), (0.62, 0.3, -70), (-0.62, 0.3, 70)):
|
||||||
|
k.prism(T((x, y, 0.24)) @ RZ(rot) @ RX(-78), M.rect(0.42, 0.4, (0.08, 0.08, 0, 0)), 0.1, 0.03) # its tabs
|
||||||
|
|
||||||
|
|
||||||
|
def corrugated(g, points, r, pitch=0.09):
|
||||||
|
"""A ribbed hose through points: a core rod with a collar every `pitch`."""
|
||||||
|
points = [Vector(q) for q in points]
|
||||||
|
for a, b in zip(points, points[1:]):
|
||||||
|
g.rod(a, b, 0.86 * r, 12)
|
||||||
|
n = max(1, int((b - a).length / pitch))
|
||||||
|
for j in range(n):
|
||||||
|
g.cylinder(F(a.lerp(b, (j + 0.5) / n), b - a), 1.12 * r, 0.5 * pitch, 14)
|
||||||
|
return g
|
||||||
|
|
||||||
|
|
||||||
|
def chest(b):
|
||||||
|
"""CHEST PLATES. Origin at the middle of the chest; the plates' lower edge is z = -0.55. One faceted breast
|
||||||
|
mass; on its front a centre panel with clipped lower corners (the number goes on it); on the mech's left a
|
||||||
|
boxed pectoral block standing proud; on its right a pectoral plate lying on the facet; a row of five vent
|
||||||
|
teeth under the front edge; a two-tier sternum block hung below; under that the dark abdomen column with
|
||||||
|
three stacked lames and a ribbed hose each side."""
|
||||||
|
k, d = b["khaki"], b["gunmetal"]
|
||||||
|
k.hull([(0.6, 0.7, 0.95), (1.65, 0.3, 0.85), (0.62, 1.28, 0.35), (1.6, 0.82, 0.3), (0.58, 1.24, -0.5), (1.55, 0.78, -0.45), (1.7, -0.5, 0.85), (1.7, -0.5, -0.45), (0.6, -0.6, 0.95)], mirror=True)
|
||||||
|
front = F((0, 1.27, -0.05), (0, 1, 0.02), (0, 0, 1))
|
||||||
|
k.prism(front, M.rect(1.1, 0.84, (0.16, 0.16, 0.0, 0.0)), 0.06, 0.025)
|
||||||
|
k.prism(F((0, 1.0, 0.66), (0, 0.6, 1), (0, 1, 0)), [(-0.56, -0.26), (0.56, -0.26), (0.5, 0.3), (-0.5, 0.3)], 0.05, 0.02) # the upper panel
|
||||||
|
k.hull([(-0.72, 1.0, 0.56), (-1.46, 0.78, 0.5), (-0.74, 1.5, 0.42), (-1.4, 1.26, 0.38), (-0.74, 1.46, -0.22), (-1.38, 1.22, -0.26), (-0.72, 1.0, -0.3), (-1.46, 0.78, -0.3)]) # the left pectoral block
|
||||||
|
k.prism(F((1.1, 1.07, 0.0), (0.42, 1, 0.03), (0, 0, 1)), [(-0.42, -0.42), (0.3, -0.42), (0.46, -0.1), (0.46, 0.36), (-0.42, 0.36)], 0.06, 0.025) # the right pectoral plate
|
||||||
|
for j in range(5):
|
||||||
|
k.box(T((-0.44 + 0.22 * j, 1.2, -0.58)), (0.13, 0.12, 0.14))
|
||||||
|
d.box(T((0, 1.12, -0.58)), (1.1, 0.1, 0.12))
|
||||||
|
k.hull([(0.42, 0.7, -0.5), (0.42, 1.22, -0.62), (0.36, 0.7, -0.95), (0.36, 1.16, -0.95)], mirror=True) # the sternum block
|
||||||
|
k.hull([(0.3, 0.7, -0.95), (0.3, 1.12, -0.98), (0.24, 0.7, -1.22), (0.24, 1.04, -1.22)], mirror=True)
|
||||||
|
d.hull([(0.6, -0.5, -0.4), (0.6, 0.75, -0.4), (0.45, -0.4, -2.3), (0.45, 0.6, -2.3)], mirror=True) # the abdomen column
|
||||||
|
for j in range(3):
|
||||||
|
z = -1.36 - 0.3 * j
|
||||||
|
k.hull([(0.36 - 0.03 * j, 0.6, z), (0.36 - 0.03 * j, 0.92 - 0.05 * j, z + 0.02), (0.32 - 0.03 * j, 0.6, z - 0.26), (0.32 - 0.03 * j, 0.86 - 0.05 * j, z - 0.24)], mirror=True)
|
||||||
|
for s in (-1, 1):
|
||||||
|
corrugated(d, [(s * 0.95, 0.7, -0.5), (s * 0.85, 0.9, -0.95), (s * 0.62, 0.86, -1.5), (s * 0.5, 0.66, -2.0)], 0.13)
|
||||||
|
corrugated(d, [(s * 1.25, 0.5, -0.5), (s * 1.1, 0.62, -1.1), (s * 0.7, 0.5, -1.9)], 0.09)
|
||||||
|
|
||||||
|
|
||||||
|
def pauldron(b, arm=True):
|
||||||
|
"""SHOULDER PAULDRON, the mech's left: outboard is -x; origin at the shoulder's pivot. One faceted cap, crowned
|
||||||
|
along a fore-and-aft ridge, its outer face dropping steeply and its lower edge stepped by two tabs; a hexagonal
|
||||||
|
applique on the front face (the emblem's plate); a raised band where crown meets outer face; a small ridge
|
||||||
|
plate on the crown. Under it the upper arm: two boxed tiers and a pair of ringed elbow discs."""
|
||||||
|
k, d = b["khaki"], b["gunmetal"]
|
||||||
|
k.hull([(0.55, 0.3, 1.25), (0.55, -0.9, 1.2), (-0.45, 0.35, 1.55), (-0.45, -0.85, 1.5), (-1.4, 0.4, 0.95), (-1.4, -0.8, 0.95), (-1.65, 0.5, -0.35), (-1.65, -0.7, -0.35),
|
||||||
|
(0.45, 1.0, 0.7), (-0.55, 1.2, 0.9), (-1.3, 1.05, 0.3), (-1.25, 1.1, -0.45), (0.35, 1.05, -0.15), (0.5, -1.4, 0.6), (-1.3, -1.4, 0.3), (-1.25, -1.35, -0.4), (0.4, -1.35, -0.1), (0.55, 0.3, -0.1), (0.55, -0.9, -0.1)])
|
||||||
|
k.prism(F((-0.4, 1.14, 0.28), (-0.06, 1, 0.12), (0, 0, 1)), [(-0.5, -0.5), (0.3, -0.56), (0.62, -0.1), (0.5, 0.46), (-0.2, 0.56), (-0.6, 0.1)], 0.07, 0.03) # the emblem's plate
|
||||||
|
k.prism(F((-0.95, 0.3, 1.26), (-0.55, 0.1, 0.85), (0, 1, 0)), M.rect(0.16, 1.5, 0.03), 0.05, 0.02) # the band
|
||||||
|
k.prism(F((0.1, -0.2, 1.42), (0.28, 0.0, 1), (0, 1, 0)), M.rect(0.5, 0.8, 0.06), 0.06, 0.02) # the ridge plate
|
||||||
|
for y in (0.45, -0.25):
|
||||||
|
k.prism(F((-1.66, y, -0.42), (-1, 0, 0.05), (0, 0, 1)), M.rect(0.42, 0.36, (0.06, 0.06, 0, 0)), 0.08, 0.03) # the tabs
|
||||||
|
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 pair of ringed elbow discs and a ribbed strip between them."""
|
||||||
|
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))
|
||||||
|
for x in (-0.31, 0.31):
|
||||||
|
ringed_disc(d, at @ F((x, 0.3, -2.1), (0, 1, 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))
|
||||||
|
|
||||||
|
|
||||||
|
def thigh(b):
|
||||||
|
"""THIGH PLATE, the mech's left thigh from the front: outboard is -x; origin at the plate's middle, z up. A
|
||||||
|
tall front plate, broad above and stepping in to a tongue below; over its upper part an applique whose lower
|
||||||
|
edge drops in a centre tab; a second applique on the tongue; down the outboard side a strip plate turned back
|
||||||
|
along the leg; the girder behind."""
|
||||||
|
k, d = b["khaki"], b["gunmetal"]
|
||||||
|
main = F((0, 0.5, 0), (0, 1, 0), (0, 0, 1))
|
||||||
|
k.prism(main, [(-0.5, -1.3), (0.5, -1.3), (0.56, -0.5), (0.74, -0.3), (0.78, 1.1), (0.6, 1.3), (-0.6, 1.3), (-0.78, 1.1), (-0.74, -0.3), (-0.56, -0.5)], 0.22, 0.07, 0.95)
|
||||||
|
k.prism(main @ T((0, 0.48, 0.22)), [(-0.66, -0.56), (-0.28, -0.56), (-0.22, -0.82), (0.22, -0.82), (0.28, -0.56), (0.66, -0.56), (0.68, 0.6), (0.52, 0.74), (-0.52, 0.74), (-0.68, 0.6)], 0.06, 0.025)
|
||||||
|
k.prism(main @ T((0, -0.86, 0.22)), [(-0.4, -0.36), (0.4, -0.36), (0.44, 0.24), (-0.44, 0.24)], 0.05, 0.02)
|
||||||
|
k.hull([(-0.82, 0.62, 1.05), (-1.0, 0.2, 1.0), (-1.02, -0.5, 0.9), (-0.82, 0.62, -0.4), (-0.98, 0.2, -0.7), (-1.0, -0.5, -0.6), (-0.8, 0.2, 1.0), (-0.8, 0.2, -0.6), (-0.8, -0.5, 0.9), (-0.8, -0.5, -0.6)]) # the side strip
|
||||||
|
d.box(T((0, 0.05, 0)), (0.9, 0.9, 2.9))
|
||||||
|
|
||||||
|
|
||||||
|
def shin(b):
|
||||||
|
"""SHIN PLATES, the mech's left shin from the front: origin at the middle, z up, the knee at +1.3. Down the
|
||||||
|
front three lapped tiers, the first with a framed dark window, the last flaring to the ankle; over the first
|
||||||
|
a knee guard pointed upward; each side a long faceted plate bulging at the calf; an ankle skirt; the girder."""
|
||||||
|
k, d = b["khaki"], b["gunmetal"]
|
||||||
|
front = lambda z, y=0.62: F((0, y, z), (0, 1, 0.02), (0, 0, 1))
|
||||||
|
k.prism(front(-0.95, 0.5), [(-0.5, -0.45), (0.5, -0.45), (0.3, 0.5), (-0.3, 0.5)], 0.16, 0.05) # third tier, flaring
|
||||||
|
k.prism(front(-0.15, 0.58), [(-0.27, -0.55), (0.27, -0.55), (0.33, 0.5), (-0.33, 0.5)], 0.16, 0.05) # second
|
||||||
|
k.prism(front(0.62, 0.66), [(-0.33, -0.5), (0.33, -0.5), (0.4, 0.36), (0.2, 0.56), (-0.2, 0.56), (-0.4, 0.36)], 0.16, 0.05) # first
|
||||||
|
d.box(front(0.6, 0.66) @ T((0, 0, 0.165)), (0.3, 0.36, 0.02))
|
||||||
|
for x, w, h in ((0, 0.4, 0.05), (0, 0.4, 0.05)):
|
||||||
|
pass
|
||||||
|
for dx, dy, sx, sy in ((0, 0.2, 0.4, 0.05), (0, -0.2, 0.4, 0.05), (0.19, 0, 0.05, 0.42), (-0.19, 0, 0.05, 0.42)):
|
||||||
|
k.box(front(0.6, 0.66) @ T((dx, dy, 0.175)), (sx, sy, 0.04))
|
||||||
|
k.hull([(0, 0.95, 1.5), (0.42, 0.8, 1.05), (0.3, 0.92, 0.95), (0, 1.0, 0.9), (0.4, 0.5, 1.3), (0, 0.5, 1.5)], mirror=True) # the knee guard
|
||||||
|
for s in (-1, 1):
|
||||||
|
k.hull([(s * 0.4, 0.62, 1.0), (s * 0.72, 0.3, 0.9), (s * 0.86, 0.25, 0.1), (s * 0.5, 0.66, 0.0), (s * 0.7, 0.3, -1.0), (s * 0.44, 0.56, -1.05),
|
||||||
|
(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))
|
||||||
|
|
||||||
|
|
||||||
|
PARTS = {f.__name__: f for f in (cockpit, battery, cannon, emitter, cooling, hip, knee, foot, chest, pauldron, thigh, shin)}
|
||||||
Loading…
Reference in a new issue