STAG pass 4 on sheet 37: plated limbs by their faces, soles on the ground, a lit visor, bigger breast shells, the rear three-quarter posed
Limbs: thighs, shins, metatarsi, upper arms and the left forearm rebuilt as hard plates authored by their faces (stag_limbs.py over hardplate.py, the generic form of Paladin pass 3's paladin_hard.part and _fits: slab, house, octa, part, disc, drum, hose, machine): a tall shield with the stag's emblem on each thigh over a plated housing, knee guard, greave with the unit number, calf and side plates, a long front plate over the lower leg's bare rams. The cage shells and octagonal blocks of pass 3 (stag_body.thigh_shield, shin_plate, upper_arm, limb_block) are deleted. Widths checked against the hero at its posed camera: a first cut drew the thighs a third wide and went to 0.8 m across the shield.
Contact: stag_hero.py solves the hock's bend in closed form so each ankle stands at the stance's height (pass 3 held it by a soft penalty and the right foot floated 0.2 m); legplan.Leg.foot gains a two-axis ankle (a kit cross for pitch, the foot core's tongue_roll pin for roll, each with a record) so an abducted leg's sole lies flat; stag.py grounds on the feet's exact lowest vertices, not bounding boxes, and asserts both soles within 1 cm (hero 0.0/0.005, rear3q 0.0/0.008).
Rear three-quarter: stag_hero.py solves any view with the pose (View, use); the rear three-quarter is posed there (azimuth held 140, torso turned -23 degrees on the waist, a marked horizon v 645), rms 19.0 px against pass 3's stance solve at 25.8; stag_cameras.py no longer solves it.
Visor: paint.py MechGlass gains Glow and Glow Color and a visor_amber preset; the cockpit's visor is a sloped band 1.1 m wide set back under the brow's lip.
Breast shells wider (1.22 m), front faces turned 30 degrees outboard, the underside cut up in a V; the keel 0.92 m across. Dorsal cover carries the stag's head (surface.emblem "stag"). massing.py and surface.py from nibu/fable-paladin-3 (c35e57e). Sheets compare pass 3.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
e65e3c11fc
commit
abe7b93cc4
14 changed files with 1100 additions and 439 deletions
|
|
@ -3774,7 +3774,7 @@
|
|||
}
|
||||
},
|
||||
"marks": {
|
||||
"_doc": "Pass 2: marks past the joints, for the hero and rear three-quarter cameras and the arrays' two-view lift. brow.r/l: the brow's lip, its outer front corners; sole.r/l: the middle of each foot's footprint on the ground; battery.r/l: the middle of each battery's cell face; housings in the rear elevation: the centre of each housing's blob (the rear shows no ir housing: it hides behind the lidar's). The rear three-quarter's soles are left unmarked: its feet stand in shadow and ground clutter. Pass 3: rear3q battery marks re-marked on the cell faces' centres (pass 2's battery.l at 612,183 sat on the dorsal module's crown between the two batteries, which is the 96 to 102 px miss of follow-up stag-rear3q-batteries); hero_horizon: the far ground's edge behind the legs (the vehicles' and treeline's feet), v 660. n37.r/l (hero): the centre of the 37 on each breast shell: the torso's turn, which the shoulder pins under the shells do not give.",
|
||||
"_doc": "Pass 2: marks past the joints, for the hero and rear three-quarter cameras and the arrays' two-view lift. brow.r/l: the brow's lip, its outer front corners; sole.r/l: the middle of each foot's footprint on the ground; battery.r/l: the middle of each battery's cell face; housings in the rear elevation: the centre of each housing's blob (the rear shows no ir housing: it hides behind the lidar's). The rear three-quarter's soles are left unmarked: its feet stand in shadow and ground clutter. Pass 3: rear3q battery marks re-marked on the cell faces' centres (pass 2's battery.l at 612,183 sat on the dorsal module's crown between the two batteries, which is the 96 to 102 px miss of follow-up stag-rear3q-batteries); hero_horizon: the far ground's edge behind the legs (the vehicles' and treeline's feet), v 660. n37.r/l (hero): the centre of the 37 on each breast shell: the torso's turn, which the shoulder pins under the shells do not give. Pass 4: rear3q_horizon, the far ground's edge behind the legs (the vehicles' and the trees' feet), v 645: without it the rear three-quarter's posed solve stood its eye 6 m up.",
|
||||
"hero": {
|
||||
"brow.r": [
|
||||
214,
|
||||
|
|
@ -3853,7 +3853,8 @@
|
|||
829.0
|
||||
]
|
||||
},
|
||||
"hero_horizon": 660
|
||||
"hero_horizon": 660,
|
||||
"rear3q_horizon": 645
|
||||
},
|
||||
"array_hero": {
|
||||
"_doc": "Pass 3: the two arrays' trees in the hero view, marked on a 5x grid: root (the pylon's foot on the breast), node (the trunk's top, where the spars part); a spar a housing: from (where it leaves the trunk, the node or its parent spar), base (where it enters the housing's underside), centre (the housing's face). stag_hero.py arrays lifts them through the posed hero camera onto the arrays' frontal plane.",
|
||||
|
|
@ -4019,4 +4020,4 @@
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
262
surfaces/blender/experiments/mechs/hardplate.py
Normal file
262
surfaces/blender/experiments/mechs/hardplate.py
Normal file
|
|
@ -0,0 +1,262 @@
|
|||
"""Hard plates authored by their faces, with stepped, bolted detail on top: the method of nibu/fable-bastion-2
|
||||
(bastion_form) as Paladin pass 3 wrote it for limbs (nibu/fable-paladin-3 c35e57e, paladin_hard.part and _fits),
|
||||
made generic so any mech's tables can use it. STAG pass 4 is the first caller (stag_limbs.py). Runs inside Blender.
|
||||
|
||||
A plate is a table row (name, spec); a spec is one of:
|
||||
slab(at, n, outline, thick, ...) an outline drawn on the plate's outer face (the plane through `at` facing `n`;
|
||||
the outline's a toward `right`, b toward `up`), a thickness, a chamfer on the
|
||||
face's rim; `fit` lists what stands on that face, in the face's (a, b)
|
||||
house(sections) a housing of chamfered sections down a limb: [(z, width, y0, y1, chamfer)]
|
||||
solid(points) a convex solid on given corners
|
||||
Each becomes a faceted convex solid (massing.hard): no shell, no folded face, every facet flat.
|
||||
|
||||
Fits on a slab's face: ("bolts", inset, spacing), ("slot", a, b, w, h), ("vents", a, b, w, h, count),
|
||||
("port", a, b, r), ("handle", a, b, length), ("eye", a, b), ("step", outline, a, b, lift) a raised panel stepped
|
||||
on the face, and a marking name ("mark", "mark2", "num", ...) at (a, b), whose text or emblem the caller's `marks`
|
||||
gives per (prefix, side, name): ("37", height) a numeral, ("emblem:<kind>", height) a surface.emblem.
|
||||
|
||||
Tools here, each used by more than one part:
|
||||
part(prefix, tag, table, frame, host, sx, marks) a table built at a world frame (x outboard on a limb, y forward,
|
||||
z up the limb), mirrored across x for sx -1, clad, fitted, frozen, adopted
|
||||
disc(g, at, r, w) / drum(g, at, r, length) a bearing's stepped, bolted cover; a ribbed drum or bellows
|
||||
hose(name, host, a, da, b, db, r) mechlib.hose between two world points, adopted to a host
|
||||
machine(name, host, build, mat) a Geo drawn by build(g), adopted to a host
|
||||
adopt(host, objects) parent keeping the world transform
|
||||
HARD and COUNT gather the report: each plate's kind, corners and facets; panels, fits, marks, hoses, failures.
|
||||
"""
|
||||
import math
|
||||
import random
|
||||
|
||||
import bpy
|
||||
from mathutils import Matrix, Vector
|
||||
|
||||
import massing as MS
|
||||
import mechlib as M
|
||||
|
||||
P, P2, CORE = "khaki", "olive_light", "gunmetal"
|
||||
UP, FWD, OUT = (0, 0, 1), (0, 1, 0), (1, 0, 0)
|
||||
T = Matrix.Translation
|
||||
HARD = {}
|
||||
COUNT = {"panels": 0, "fits": 0, "marks": 0, "hoses": 0, "failed": []}
|
||||
MARKING = {"mark", "mark2", "mark3", "num"}
|
||||
|
||||
|
||||
def slab(at, n, outline, thick, up=UP, right=OUT, taper=0.04, mat=P, clad=True, fit=(), back=1.0, bevel=0.022):
|
||||
return {"kind": "slab", "at": at, "n": n, "outline": outline, "thick": thick, "up": up, "right": right, "taper": taper, "mat": mat, "clad": clad,
|
||||
"fit": list(fit), "back": back, "bevel": bevel}
|
||||
|
||||
|
||||
def house(sections, mat=CORE, clad=False, bevel=0.02):
|
||||
return {"kind": "house", "sections": sections, "mat": mat, "clad": clad, "bevel": bevel, "fit": []}
|
||||
|
||||
|
||||
def solid(points, mat=CORE, clad=False, bevel=0.02, mirror=False):
|
||||
return {"kind": "points", "points": points, "mat": mat, "clad": clad, "bevel": bevel, "fit": [], "mirror": mirror}
|
||||
|
||||
|
||||
def hexa(w, h, c):
|
||||
"""A rectangle w by h with its four corners cut c: the commonest plate outline."""
|
||||
return [(-w / 2 + c, h / 2), (w / 2 - c, h / 2), (w / 2, h / 2 - c), (w / 2, -h / 2 + c), (w / 2 - c, -h / 2), (-w / 2 + c, -h / 2), (-w / 2, -h / 2 + c), (-w / 2, h / 2 - c)]
|
||||
|
||||
|
||||
def octa(w, h, top, bottom):
|
||||
"""An elongated octagon w by h, its top corners cut `top` across and its bottom corners `bottom`: a limb's shield."""
|
||||
return [(-w / 2 + top, h / 2), (w / 2 - top, h / 2), (w / 2, h / 2 - 1.6 * top), (w / 2, -h / 2 + 1.6 * bottom), (w / 2 - bottom, -h / 2),
|
||||
(-w / 2 + bottom, -h / 2), (-w / 2, -h / 2 + 1.6 * bottom), (-w / 2, h / 2 - 1.6 * top)]
|
||||
|
||||
|
||||
def adopt(host, objects):
|
||||
"""Parent `objects` (those without a parent) to `host`, keeping where they stand."""
|
||||
M.update()
|
||||
inv = host.matrix_world.inverted()
|
||||
for o in objects:
|
||||
if o.parent is None and o is not host:
|
||||
world = o.matrix_world.copy()
|
||||
o.parent = host
|
||||
o.matrix_parent_inverse = Matrix.Identity(4)
|
||||
o.matrix_basis = inv @ world
|
||||
M.update()
|
||||
|
||||
|
||||
def freeze(obj):
|
||||
if obj.modifiers:
|
||||
try:
|
||||
bpy.ops.brokkr_kitbash.freeze(object_name=obj.name)
|
||||
except RuntimeError as error:
|
||||
print(f"FREEZE {obj.name} refused: {str(error).strip()[:160]}", flush=True)
|
||||
|
||||
|
||||
def _mx(v, sx):
|
||||
return Vector((sx * v[0], v[1], v[2]))
|
||||
|
||||
|
||||
def _flat(obj):
|
||||
for p in obj.data.polygons:
|
||||
p.use_smooth = False
|
||||
return obj
|
||||
|
||||
|
||||
def _fits(spec, PMw, face, geos, key, clad, z0, marks):
|
||||
"""What stands on a slab's outer face, at PMw (the face's frame in the world: x the outline's a, y its b, z out).
|
||||
Geometry goes into geos[material]; marks and handles go through surface.py on `face` (a massing.Face)."""
|
||||
import surface as S
|
||||
n, b = PMw.col[2].xyz.normalized(), PMw.col[1].xyz.normalized()
|
||||
at = lambda x, y, z=0.0: PMw @ Vector((x, y, z0 + z)) # noqa: E731
|
||||
upright = lambda x, y, z=0.0, up=None: M.frame_at(at(x, y, z), n, up or b) # noqa: E731 a right-handed frame on the face
|
||||
g, dark = geos.setdefault("gunmetal", M.Geo()), geos.setdefault("pit", M.Geo())
|
||||
rim = geos.setdefault(spec["mat"], M.Geo())
|
||||
for kind, *a in spec["fit"]:
|
||||
try:
|
||||
if kind == "bolts":
|
||||
inset, spacing = (0.04, a[1]) if clad else a
|
||||
flat = [Vector(p) for p in spec["outline"]]
|
||||
ring = M._inset(flat if sum(flat[i].x * flat[(i + 1) % len(flat)].y - flat[(i + 1) % len(flat)].x * flat[i].y for i in range(len(flat))) > 0 else flat[::-1], inset + spec["taper"])
|
||||
frames = []
|
||||
for i in range(len(ring)):
|
||||
p, q = ring[i], ring[(i + 1) % len(ring)]
|
||||
count = max(1, int((q - p).length / spacing))
|
||||
frames += [upright(*(p.lerp(q, (j + 0.5) / count)), -z0) for j in range(count)]
|
||||
S.bolt_row(face, frames, r=0.017, mat="gunmetal")
|
||||
elif kind == "slot":
|
||||
x, y, w, h = a
|
||||
dark.box(upright(x, y, 0.006), (w, h, 0.012))
|
||||
for dx, dy, sw, sh in ((0, h / 2 + 0.016, w + 0.06, 0.032), (0, -h / 2 - 0.016, w + 0.06, 0.032), (w / 2 + 0.016, 0, 0.032, h), (-w / 2 - 0.016, 0, 0.032, h)):
|
||||
rim.box(upright(x + dx, y + dy, 0.014), (sw, sh, 0.028))
|
||||
elif kind == "vents":
|
||||
x, y, w, h, count = a
|
||||
pitch = 2.7 * h
|
||||
for i in range(count):
|
||||
yy = y + (i - (count - 1) / 2) * pitch
|
||||
dark.box(upright(x, yy, 0.005), (w, h, 0.01))
|
||||
rim.box(upright(x, yy + 0.75 * h, 0.014) @ Matrix.Rotation(math.radians(-28), 4, "X"), (w + 0.04, 0.9 * h, 0.012))
|
||||
elif kind == "port":
|
||||
x, y, r = a
|
||||
fr = upright(x, y)
|
||||
geos.setdefault("machine", M.Geo()).lathe(fr, [(0, 0), (r, 0), (r, 0.035), (0.82 * r, 0.05), (0.82 * r, 0.022), (0.34 * r, 0.022), (0.34 * r, 0.045), (0, 0.045)], 28)
|
||||
g.bolts(fr @ T((0, 0, 0.035)), 0.91 * r, 8, 0.07 * r, 0.012)
|
||||
elif kind == "handle":
|
||||
x, y, length = a
|
||||
S.grab_handle(face, upright(x, y) @ Matrix.Rotation(math.radians(90), 4, "Z"), length=length, lift=0.065, r=0.016)
|
||||
elif kind == "eye":
|
||||
S.lifting_eye(face, upright(a[0], a[1]), size=0.1)
|
||||
elif kind == "step":
|
||||
outline, x, y, lift = a
|
||||
MS.panel(geos.setdefault(P2 if spec["mat"] == P else P, M.Geo()), [at(x + px, y + py) for px, py in outline], lift=lift, inset=0.0, out=n, bolts=g)
|
||||
elif kind in MARKING:
|
||||
what = marks.get(key + (kind,))
|
||||
if what is None:
|
||||
continue
|
||||
text, height = what
|
||||
fr = M.frame_at(at(a[0], a[1], 0.003), n, b) # a mark stands on the face's own up
|
||||
if text.startswith("emblem:"):
|
||||
S.emblem(face, fr, text.split(":", 1)[1], height, "marking")
|
||||
else:
|
||||
S.numeral(face, fr, text, height, "marking")
|
||||
COUNT["marks"] += 1
|
||||
continue
|
||||
else:
|
||||
raise ValueError(f"no fit named {kind}")
|
||||
COUNT["fits"] += 1
|
||||
except Exception as error: # a fit that fails is listed and left out, not hidden
|
||||
COUNT["failed"].append(f"{'.'.join(key[:2])} {kind}: {type(error).__name__} {str(error)[:100]}")
|
||||
|
||||
|
||||
def part(prefix, tag, table, frame, host, sx=1, seed=0, marks=None, kinds=None):
|
||||
"""A table of plates [(name, spec[, sided])] built at `frame` (a world matrix: the table's own frame, x outboard
|
||||
on a limb), mirrored across the frame's x for sx -1, each a massing.hard solid; a slab's outer face is clad (a
|
||||
raised panel, split in two at uneven lifts where it carries no mark) and takes its fits. Everything is frozen
|
||||
and adopted to `host`. A row with a third entry True is built once a side (a centre part's sided plates).
|
||||
Returns {name: object}."""
|
||||
import surface as S
|
||||
S.materials()
|
||||
marks, kinds = marks or {}, kinds or {}
|
||||
made, rnd = {}, random.Random(seed)
|
||||
for row in table:
|
||||
name, spec = row[0], row[1]
|
||||
sides = ((1, "R"), (-1, "L")) if len(row) > 2 and row[2] else ((sx, tag),)
|
||||
for s, t in sides:
|
||||
full = f"{prefix}{t}.{name}"
|
||||
if spec["kind"] == "slab":
|
||||
pts = MS.slab_points(spec["at"], spec["n"], spec["outline"], spec["thick"], spec["taper"], spec["up"], spec["right"], spec["back"])
|
||||
elif spec["kind"] == "house":
|
||||
pts = MS.section_points(spec["sections"])
|
||||
else:
|
||||
pts = list(spec["points"]) + ([(-x, y, z) for x, y, z in spec["points"] if abs(x) > 1e-6] if spec.get("mirror") else [])
|
||||
obj = MS.hard(full, [frame @ _mx(p, s) for p in pts], None, spec["mat"], bevel=spec["bevel"])
|
||||
obj["plate_kind"] = kinds.get(f"{prefix}.{name}", "hard")
|
||||
HARD[full] = {"kind": obj["plate_kind"], "corners": len(obj.data.vertices), "facets": len(obj.data.polygons), "thick": spec.get("thick")}
|
||||
made[full] = obj
|
||||
if spec["kind"] != "slab":
|
||||
continue
|
||||
a, b, n = MS.plane_basis(spec["n"], spec["up"], spec["right"])
|
||||
PM = Matrix((_mx(a, s), _mx(b, s), _mx(n, s))).transposed().to_4x4()
|
||||
PM.translation = _mx(spec["at"], s)
|
||||
PMw = frame @ PM
|
||||
nw = PMw.col[2].xyz.normalized()
|
||||
geos, lift = {}, 0.0
|
||||
marked = any(k[0] in MARKING and marks.get((prefix, t, k[0])) for k in spec["fit"])
|
||||
if spec["clad"]:
|
||||
lift = 0.045
|
||||
g = geos.setdefault(P2 if spec["mat"] == P else P, M.Geo())
|
||||
plain = marked or any(k[0] in ("slot", "port", "vents", "handle", "eye", "step") for k in spec["fit"])
|
||||
COUNT["panels"] += MS.clad(obj, g, keep=lambda fn, c: fn.dot(nw) > 0.97, min_area=0.12, lifts=(lift, lift) if plain else (0.035, 0.06), inset=0.06, gap=0.04,
|
||||
split=99.0 if plain else 0.45, seed=rnd.randrange(1 << 20), bolts=geos.setdefault("gunmetal", M.Geo()))
|
||||
face = MS.Face(obj, "gunmetal")
|
||||
_fits(spec, PMw, face, geos, (prefix, t), spec["clad"], lift, marks)
|
||||
face.done()
|
||||
for mat, g in geos.items():
|
||||
if len(g.bm.verts):
|
||||
o = g.to_object(f"{full}.fit.{mat}", mat, obj, 1.0 if mat in (P, P2) else 30.0)
|
||||
if mat in (P, P2):
|
||||
mod = o.modifiers.new("Bevel", "BEVEL")
|
||||
mod.width, mod.segments, mod.limit_method, mod.angle_limit = 0.008, 1, "ANGLE", math.radians(20)
|
||||
_flat(o)
|
||||
M.update()
|
||||
for obj in made.values():
|
||||
for o in [obj] + list(obj.children):
|
||||
if o.type == "MESH":
|
||||
freeze(o)
|
||||
adopt(host, list(made.values()))
|
||||
return made
|
||||
|
||||
|
||||
def disc(g, at, r, w, rings=3, bolts=12):
|
||||
"""A bearing's cover: a drum along at's z from 0 to w, its outer face stepped in `rings` rings to a hub, a bolt
|
||||
circle on its rim."""
|
||||
prof = [(0, 0), (r, 0), (r, 0.72 * w)]
|
||||
for k in range(rings):
|
||||
r0, r1 = r * (1 - 0.8 * k / rings), r * (1 - 0.8 * (k + 0.55) / rings)
|
||||
z = w * (0.72 + 0.28 * (k % 2))
|
||||
prof += [(r0, z), (r1, z)]
|
||||
prof += [(0.16 * r, w * 1.05), (0, w * 1.05)]
|
||||
g.lathe(at, prof, 40)
|
||||
g.bolts(at @ T((0, 0, 0.72 * w)), 0.9 * r, bolts, 0.04 * r, 0.05 * r)
|
||||
return g
|
||||
|
||||
|
||||
def drum(g, at, r, length, ribs=5, depth=0.08):
|
||||
"""A ribbed drum or bellows along at's z."""
|
||||
prof = [(0.0, 0.0), (r - depth, 0.0)]
|
||||
for i in range(ribs):
|
||||
z = length * i / ribs
|
||||
step = length / ribs
|
||||
prof += [(r - depth, z + 0.12 * step), (r, z + 0.3 * step), (r, z + 0.7 * step), (r - depth, z + 0.88 * step)]
|
||||
prof += [(r - depth, length), (0.0, length)]
|
||||
g.lathe(at, prof, 36)
|
||||
return g
|
||||
|
||||
|
||||
def hose(name, host, a, da, b, db, r=0.05, sag=0.0, via=(), stiffness=0.45):
|
||||
"""mechlib.hose between two world points, leaving along da and arriving against db, with its ferrules, adopted
|
||||
to `host` (laid as the figure stands: it does not follow a pose)."""
|
||||
M.hose(name, a, da, b, db, r, sag=sag, via=via, stiffness=stiffness)
|
||||
adopt(host, [o for o in (bpy.data.objects.get(name), bpy.data.objects.get(name + ".ferrules")) if o is not None])
|
||||
COUNT["hoses"] += 1
|
||||
|
||||
|
||||
def machine(name, host, build, mat="machine", smooth=38.0):
|
||||
g = M.Geo()
|
||||
build(g)
|
||||
obj = g.to_object(name, mat, None, smooth)
|
||||
adopt(host, [obj])
|
||||
return obj
|
||||
|
|
@ -128,13 +128,31 @@ class Leg:
|
|||
self.records.append(record(seg, roll - below, roll + above, mechanism))
|
||||
self.miss = [(M.sockets(seg)["clevis"].translation - Vector(p)).length for seg, p in zip(self.parts, pins)]
|
||||
|
||||
def foot(self, fn, name, mechanism="ankle_pitch", below=30.0, above=25.0, pitch=0.0, **kw):
|
||||
def foot(self, fn, name, mechanism="ankle_pitch", below=30.0, above=25.0, pitch=0.0, roll=None, cross=(0.12, 0.42), **kw):
|
||||
"""A feet.py foot on the last segment's clevis, levelled (its sole down, `pitch` nose down), with the
|
||||
ankle's record. Returns the Foot."""
|
||||
foot = fn(name, shin=self.parts[-1], socket="clevis", **kw)
|
||||
foot.level(pitch)
|
||||
roll = float(foot.core["kit_roll"])
|
||||
self.records.append(record(foot.core, roll - below, roll + above, mechanism))
|
||||
ankle's record. With `roll` (degrees (below, above)), a two-axis ankle: a kit cross on the clevis (the pitch
|
||||
pin, `cross` its drop and width) and the foot's core on the cross's clevis by its tongue_roll pin, each with
|
||||
its record. A leg splayed at the hip tilts the pitch pin; the roll pin is what lays the sole flat (pass 4:
|
||||
STAG's hero, a foot rolled with its abducted leg stood one sole 0.11 m over the other). The foot's drop is
|
||||
then the skeleton's ankle height less the cross's drop. Returns the Foot."""
|
||||
bpy, M, _, Vector = _bpy()
|
||||
if roll is None:
|
||||
foot = fn(name, shin=self.parts[-1], socket="clevis", **kw)
|
||||
foot.level(pitch)
|
||||
r = float(foot.core["kit_roll"])
|
||||
self.records.append(record(foot.core, r - below, r + above, mechanism))
|
||||
else:
|
||||
drop, width = cross
|
||||
cr = M.attach(M.place("cross", f"{self.tag}.Ankle", mat="machine", drop=drop, width=width, pin_r=kw.get("pin_r", 0.1)), "tongue", self.parts[-1], "clevis")
|
||||
foot = fn(name, shin=None, **kw)
|
||||
M.attach(foot.core, "tongue_roll", cr, "clevis")
|
||||
M.aim_roll(cr, (0, 0, 1), Vector((0, 0, -1))) # the cross hangs plumb as near as the pitch pin lets
|
||||
M.aim_roll(foot.core, (0, 0, 1), Vector((0, 0, -1))) # the roll pin takes what the tilted pitch pin leaves
|
||||
r = float(cr["kit_roll"])
|
||||
self.records.append(record(cr, r - below, r + above, mechanism))
|
||||
r = float(foot.core["kit_roll"])
|
||||
self.records.append(record(foot.core, r - roll[0], r + roll[1], "ankle_roll"))
|
||||
self.ankle = cr
|
||||
self.feet = foot
|
||||
return foot
|
||||
|
||||
|
|
|
|||
|
|
@ -27,6 +27,9 @@ Hard plates (a plate whose silhouette the concept draws faceted: mech-lessons-20
|
|||
corners(planes) the corners of the convex solid a set of faces bounds: every three
|
||||
faces' meeting point that lies inside all the others. Authoring a
|
||||
plate by its faces is what keeps every facet flat.
|
||||
slab_points(at, normal, outline, thick) a hard plate as a thick slab: an outline drawn on its outer face (the
|
||||
plane through `at` facing `normal`), the face's rim chamfered by `taper`
|
||||
section_points(sections) a housing's corners from chamfered sections down a limb
|
||||
hard(name, points, host, ...) a faceted solid on those corners (or any points): flat faces, every
|
||||
edge chamfered by a bevel; obj["plate_kind"] = "hard"
|
||||
panel(geo, polygon, ...) a raised inner panel on a flat polygon: inset, lifted, chamfered
|
||||
|
|
@ -408,6 +411,47 @@ def corners(planes, tol=1e-6):
|
|||
return out
|
||||
|
||||
|
||||
def plane_basis(normal, up=(0, 0, 1), right=None):
|
||||
"""(a, b, n): unit axes of the plane facing `normal`: b the in-plane part of `up`, a across it, turned to the
|
||||
side `right` points to where one is given (so an outline's +a is a named direction on either side of a mech)."""
|
||||
n = Vector(normal).normalized()
|
||||
b = Vector(up) - n * n.dot(Vector(up))
|
||||
if b.length < 1e-6:
|
||||
raise ValueError("massing.plane_basis: up lies along the normal")
|
||||
b.normalize()
|
||||
a = b.cross(n)
|
||||
if right is not None and a.dot(Vector(right)) < 0:
|
||||
a = -a
|
||||
return a, b, n
|
||||
|
||||
|
||||
def slab_points(at, normal, outline, thick, taper=0.04, up=(0, 0, 1), right=None, back=1.0):
|
||||
"""The corners of a hard plate authored as a slab: `outline` [(a, b)] is its outer face, drawn on the plane
|
||||
through `at` facing `normal` (plane_basis); the face's rim is chamfered `taper` wide and deep; the back face
|
||||
stands `thick` behind, its outline scaled by `back` about the middle (under 1: a plate undercut to its seat)."""
|
||||
a, b, n = plane_basis(normal, up, right)
|
||||
at = Vector(at)
|
||||
flat = [Vector((x, y)) for x, y in outline]
|
||||
area = 0.5 * sum(flat[i].x * flat[(i + 1) % len(flat)].y - flat[(i + 1) % len(flat)].x * flat[i].y for i in range(len(flat)))
|
||||
ring = flat if area > 0 else flat[::-1]
|
||||
inner = M._inset(ring, taper) if taper else ring
|
||||
out = [at + a * p.x + b * p.y for p in inner]
|
||||
if taper:
|
||||
out += [at + a * p.x + b * p.y - n * taper for p in ring]
|
||||
out += [at + a * p.x * back + b * p.y * back - n * thick for p in ring]
|
||||
return out
|
||||
|
||||
|
||||
def ring8(w, y0, y1, c):
|
||||
"""A chamfered rectangle's eight corners: w across x, from y0 to y1."""
|
||||
return [(-w / 2 + c, y0), (w / 2 - c, y0), (w / 2, y0 + c), (w / 2, y1 - c), (w / 2 - c, y1), (-w / 2 + c, y1), (-w / 2, y1 - c), (-w / 2, y0 + c)]
|
||||
|
||||
|
||||
def section_points(sections):
|
||||
"""A housing's corners from its sections down a limb: [(z, width, y0, y1, chamfer)]."""
|
||||
return [(x, y, z) for z, w, y0, y1, c in sections for x, y in ring8(w, y0, y1, c)]
|
||||
|
||||
|
||||
def hard(name, points, host=None, mat="olive", mirror=False, bevel=0.03, sx=1):
|
||||
"""A hard plate or block: the faceted convex solid on `points` (massing.corners of its faces, or corners given
|
||||
outright), every facet flat, every edge chamfered `bevel` wide. `sx` -1 builds its mirror across x; `mirror`
|
||||
|
|
|
|||
|
|
@ -22,7 +22,8 @@ material(name, role="armour", preset="seraph", **overrides)
|
|||
glass(name, preset="smoked", **overrides)
|
||||
one MechGlass material. GLASS: smoked (a near-black canopy pane: RAPTOR, 38.webp), amber (a
|
||||
dark amber dome: WYVERN, 35.webp), faceted (smoked, broken into panes by a dark lattice),
|
||||
lens (a coated blue optic), lens_amber (a laser's or lamp's warm optic).
|
||||
lens (a coated blue optic), lens_amber (a laser's or lamp's warm optic), visor_amber (an amber
|
||||
visor lit from inside: STAG, 37.webp; Glow adds Glow Color to the emission).
|
||||
shield(objects=None, lights=None)
|
||||
light-links the glass out of the stage's area lights; only a glass with Reflect over 0 needs it.
|
||||
mirrored(*matrices)
|
||||
|
|
@ -324,6 +325,8 @@ GLASS_INPUTS = {
|
|||
"Dirt": ("NodeSocketFloat", 1.0),
|
||||
"Dirt Color": ("NodeSocketColor", (0.03, 0.028, 0.023, 1.0)),
|
||||
"Scale": ("NodeSocketFloat", 1.0),
|
||||
"Glow": ("NodeSocketFloat", 0.0), # a lit display or cockpit behind the pane: Glow Color added to the emission, strongest square on
|
||||
"Glow Color": ("NodeSocketColor", (1.0, 0.42, 0.06, 1.0)),
|
||||
}
|
||||
GLASS_OUTPUTS = {"Color": "NodeSocketColor", "Roughness": "NodeSocketFloat", "Specular": "NodeSocketFloat", "Normal": "NodeSocketVector", "Emission": "NodeSocketColor"}
|
||||
_LENS = {"roughness": 0.02, "interior": 1.0, "dirt": 0.5}
|
||||
|
|
@ -337,6 +340,9 @@ GLASS = {
|
|||
# a coated optic: a blue-violet depth, a cold reflection (WYVERN's projector and helmet sensor; RAPTOR's emitters).
|
||||
"lens": {**_LENS, "tint": (0.004, 0.005, 0.012), "interior_color": (0.0015, 0.005, 0.022), "sky_color": (0.3, 0.45, 0.95), "sky": 1.2},
|
||||
"lens_amber": {**_LENS, "tint": (0.012, 0.005, 0.002), "interior_color": (0.02, 0.0055, 0.0008), "sky_color": (0.95, 0.6, 0.3), "sky": 1.2},
|
||||
# STAG, 37.webp, RECESSED COCKPIT: the amber visor under the brow, lit from inside, its glow reading in the brow's shadow.
|
||||
# Glow 2.2 rendered the visor a flat pale-orange slab at figure scale (pass 4's first hero); 0.7 keeps it amber glass.
|
||||
"visor_amber": {"tint": (0.012, 0.004, 0.0005), "interior": 1.0, "interior_color": (0.06, 0.018, 0.002), "glow": 0.7, "glow_color": (1.0, 0.36, 0.03), "sky": 1.0},
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -421,7 +427,8 @@ def glass_group():
|
|||
tree.links.new(n.math("ADD", G["Roughness"], n.math("MAXIMUM", n.math("MULTIPLY", dirt, 0.55), n.math("MULTIPLY", bar, 0.5)), clamp=True), gout.inputs["Roughness"])
|
||||
tree.links.new(n.mul(G["Reflect"], 0.5, n.math("SUBTRACT", 1.0, n.math("MULTIPLY", dirt, 0.6))), gout.inputs["Specular"])
|
||||
tree.links.new(normal, gout.inputs["Normal"])
|
||||
tree.links.new(painted, gout.inputs["Emission"])
|
||||
glow = n.vec("SCALE", G["Glow Color"], scale=n.mul(G["Glow"], n.math("ADD", 0.45, n.math("MULTIPLY", square, 0.55)), n.math("SUBTRACT", 1.0, n.math("MULTIPLY", dirt, 0.5))))
|
||||
tree.links.new(n.vec("ADD", painted, glow), gout.inputs["Emission"])
|
||||
return tree
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -9,10 +9,12 @@ Order of the build, the mass-first method (mech-pass2-common) with the character
|
|||
cockpit, the dorsal equipment module
|
||||
full the missile batteries on the upper rear torso, angled up and out; the short arms (the laser emitter
|
||||
built into the right forearm, the manipulator on the left wrist); the digitigrade legs (legplan.py: hip,
|
||||
knee, hock and ankle pins, each a kit joint) and the articulated toes (feet.stag_claws)
|
||||
knee, hock pins and a two-axis ankle, each a kit joint) and the articulated toes (feet.stag_claws);
|
||||
pass 4: every limb plated by stag_limbs.py (hard plates by their faces, hardplate.py)
|
||||
The legs are built first all the same: the torso stands on their waist ring.
|
||||
|
||||
STAG_STAGE stops early (arrays, volume, plates, full: default). MECH_QUICK renders by Workbench. STAG_PAINT names the
|
||||
STAG_POSE: stance (default; the rear, side and inset views, turns, cages), hero or rear3q (stag_hero.py's pose solved
|
||||
with that view's camera; both soles on the ground, asserted). STAG_STAGE stops early (arrays, volume, plates, full: default). MECH_QUICK renders by Workbench. STAG_PAINT names the
|
||||
paint.apply preset (default mcr3). Writes under MECH_OUT/stag/: <stage>_<view>.png at the solved cameras (hero,
|
||||
rear3q, rear, side, and inset once stag_cameras.py has solved it from stag_points.json), <stage>_sil_<view>.png,
|
||||
<stage>_arrays_<view>.png (the arrays alone), <stage>_edges_hero.json, stag_skeleton.json, stag_points.json,
|
||||
|
|
@ -36,6 +38,7 @@ import mechlib as M
|
|||
import sensor_arrays as SA
|
||||
import stag_body as SB
|
||||
import stag_form as SF
|
||||
import stag_limbs as SL
|
||||
|
||||
t0 = time.time()
|
||||
M.setup()
|
||||
|
|
@ -48,11 +51,12 @@ QUICK = bool(os.environ.get("MECH_QUICK"))
|
|||
OUT = Path(os.environ["MECH_OUT"]) / "stag"
|
||||
assert OUT.is_absolute()
|
||||
OUT.mkdir(parents=True, exist_ok=True)
|
||||
POSE = os.environ.get("STAG_POSE", "stance") # stance: the elevations' (rear, side, rear3q, turns); hero: stag_hero.py's solved pose
|
||||
assert POSE in ("stance", "hero")
|
||||
HERO = SF.cameras()["hero"]["solved"] if POSE == "hero" else None
|
||||
J = {k: tuple(v) for k, v in HERO["joints"].items()} if HERO else SF.J
|
||||
R_TORSO = Matrix(HERO["torso"]["R"]).to_4x4() if HERO else Matrix.Identity(4)
|
||||
POSE = os.environ.get("STAG_POSE", "stance") # stance: the elevations' (rear, side, inset, turns); hero, rear3q: stag_hero.py's solved pose for that view
|
||||
assert POSE in ("stance", "hero", "rear3q")
|
||||
SOLVED = SF.cameras()[POSE]["solved"] if POSE != "stance" else None
|
||||
J = {k: tuple(v) for k, v in SOLVED["joints"].items()} if SOLVED else SF.J
|
||||
R_TORSO = Matrix(SOLVED["torso"]["R"]).to_4x4() if SOLVED else Matrix.Identity(4)
|
||||
SUFFIX = "" if POSE == "stance" else f"_{POSE}"
|
||||
REPORT = {"pose": POSE, "legs": [], "arms": [], "arrays": [], "cages": {}, "frozen": 0}
|
||||
|
||||
|
||||
|
|
@ -80,20 +84,18 @@ for tag, s in (("L", -1), ("R", 1)):
|
|||
cant = math.degrees(math.atan(s * (J[f"ankle_{k}"][0] - J[f"hip_{k}"][0]) / (J[f"hip_{k}"][2] - J[f"ankle_{k}"][2]))) # each leg's own splay: the hero's differ
|
||||
leg = legplan.Leg(f"Leg{tag}", pel, (J[f"hip_{k}"][0], J[f"hip_{k}"][1], 0.0), [J[f"knee_{k}"], J[f"hock_{k}"], J[f"ankle_{k}"]], SF.LEG["links"], SF.LEG["limits"],
|
||||
pin_r=SF.LEG["pin_r"], yoke=SF.LEG["yoke"], cant=cant, side=s)
|
||||
leg.foot(feet.stag_claws, f"Foot{tag}", **SF.LEG["foot"])
|
||||
leg.foot(feet.stag_claws, f"Foot{tag}", roll=(20.0, 20.0), cross=SF.ANKLE_CROSS, **SF.LEG["foot"])
|
||||
leg.feet.done()
|
||||
legs[tag] = leg
|
||||
th, sh, mt = leg.parts
|
||||
SB.thigh_shield(th, leg.lengths[0], s, f"Thigh{tag}")
|
||||
SB.knee(sh, s, f"Knee{tag}", r=0.34, width=0.62)
|
||||
SB.knee(mt, s, f"Hock{tag}", r=0.27, width=0.52)
|
||||
SB.knee(sh, s, f"Knee{tag}", r=0.32, width=0.52)
|
||||
SB.knee(mt, s, f"Hock{tag}", r=0.26, width=0.44)
|
||||
SB.knee(th, s, f"Hip{tag}", r=0.32, width=0.7)
|
||||
SB.shin_plate(sh, leg.lengths[1], s, f"Shin{tag}", front=0.3, width=0.26)
|
||||
SB.shin_plate(mt, leg.lengths[2], s, f"Meta{tag}", front=0.28, width=0.22)
|
||||
SL.dress("Thigh", th, leg.lengths[0], s, seed=11)
|
||||
SL.dress("Shin", sh, leg.lengths[1], s, seed=12)
|
||||
SL.dress("Meta", mt, leg.lengths[2], s, seed=13)
|
||||
SB.lower_rams(mt, leg.lengths[2], s, f"Meta{tag}")
|
||||
SB.limb_block(th, 0.2, 0.88 * leg.lengths[0], 0.62, 0.66, f"Thigh{tag}")
|
||||
SB.limb_block(sh, 0.18, 0.86 * leg.lengths[1], 0.5, 0.5, f"Shin{tag}", taper=0.8)
|
||||
SB.limb_block(mt, 0.2, 0.8 * leg.lengths[2], 0.42, 0.4, f"Meta{tag}", taper=0.9)
|
||||
SL.hoses(tag, s, th, sh)
|
||||
REPORT["legs"].append(leg.report())
|
||||
print("LEG", tag, json.dumps(leg.report()["lengths"]), "miss", leg.report()["miss"], flush=True)
|
||||
hb = M.Build("HipBeam", pel, Matrix.Identity(4))
|
||||
|
|
@ -101,10 +103,28 @@ hb[SB.CORE].prism(T((0, 0, 0.42)), M.rect(2.0, 0.78, 0.14), 0.22, 0.05)
|
|||
hb[SB.PLATE].hull([(x, y, z) for x in (-0.36, 0.36) for y, z in ((0.5, 0.3), (0.42, -0.5), (0.3, 0.3))] + [(0, 0.5, -0.62)]) # the cod plate
|
||||
hb.done()
|
||||
waist = M.attach(M.place("slew_ring", "Waist", mat="machine", r=0.36, height=WAIST_H, bolts=24, teeth=80), "base", pel, "top")
|
||||
lo, _ = M.bounds()
|
||||
pel.location.z -= lo.z # the soles on the ground: the toes' pads stand a little under the foot's drop
|
||||
|
||||
def sole_z(prefix):
|
||||
"""The lowest vertex of a foot's evaluated meshes, world: exact, where a tilted part's bounding box corners hang
|
||||
below its geometry (pass 3 grounded the build on bounding boxes)."""
|
||||
dg = bpy.context.evaluated_depsgraph_get()
|
||||
low = 1e9
|
||||
for o in bpy.context.scene.objects:
|
||||
if o.type == "MESH" and o.name.startswith(prefix):
|
||||
ev = o.evaluated_get(dg)
|
||||
mw = ev.matrix_world
|
||||
low = min([low] + [(mw @ v.co).z for v in ev.data.vertices])
|
||||
return low
|
||||
|
||||
|
||||
M.update()
|
||||
print("SOLES were at", round(lo.z, 3), "; the build stands", round(-lo.z, 3), "m higher than stag_form's skeleton", flush=True)
|
||||
soles = {tag: sole_z(f"Foot{tag}") for tag in ("L", "R")}
|
||||
pel.location.z -= min(soles.values()) # the soles on the ground: the toes' pads stand a little under the foot's drop
|
||||
M.update()
|
||||
soles = {tag: round(sole_z(f"Foot{tag}"), 4) for tag in ("L", "R")}
|
||||
REPORT["soles"] = soles
|
||||
assert all(abs(v) < 0.01 for v in soles.values()), f"a foot is off the ground: {soles}" # contact, the pose's hard constraint (stag_hero.hock_for)
|
||||
print("SOLES on the ground", soles, flush=True)
|
||||
TORSO = bpy.data.objects.new("Torso", None)
|
||||
bpy.context.scene.collection.objects.link(TORSO)
|
||||
TORSO.matrix_world = Matrix.Translation(M.sockets(waist)["top"].translation) @ R_TORSO # the hero's torso turns on the waist pin
|
||||
|
|
@ -135,13 +155,13 @@ if AT >= 2:
|
|||
SB.cockpit(TORSO)
|
||||
SB.lower_chest(TORSO)
|
||||
# markings through surface (decals that read on mirrored plates): the 37 on each breast's front face (massing.Face
|
||||
# on the hard plate), the unit number on the dorsal module's cover
|
||||
# on the hard plate), the stag's head on the dorsal module's cover
|
||||
SB.numerals(TORSO)
|
||||
import surface as S
|
||||
y1 = SF.TORSO["dorsal"]["y"][1]
|
||||
skin = S.Skin("Dorsal.cover.shell")
|
||||
z0, z1 = SF.TORSO["dorsal"]["z"]
|
||||
S.numeral(skin, skin.at((0.0, y1 - 1.0, z1 - 0.5), (0, 1, 0)), "37", 0.26)
|
||||
S.emblem(skin, skin.at((0.0, y1 - 1.0, z1 - 0.62), (0, 1, 0)), "stag", 0.62) # the rear three-quarter's stag's head
|
||||
skin.commit()
|
||||
freeze_all()
|
||||
|
||||
|
|
@ -158,11 +178,10 @@ if AT >= 3:
|
|||
[("shoulder_pitch", 60.0, 80.0), ("elbow_pitch", 75.0, 25.0)], pin_r=0.07, yoke=(0.28, 0.4, 0.4), cant=alean, side=s)
|
||||
upper, fore = arm.parts
|
||||
SB.shoulder(TORSO, s)
|
||||
SB.upper_arm(upper, arm.lengths[0], s, f"UpperArm{tag}")
|
||||
SL.dress("UpperArm", upper, arm.lengths[0], s, seed=21)
|
||||
SB.knee(fore, s, f"Elbow{tag}", r=0.22, width=0.44)
|
||||
SB.limb_block(upper, 0.12, 0.85 * arm.lengths[0], 0.36, 0.36, f"UpperArm{tag}")
|
||||
if s < 0:
|
||||
SB.limb_block(fore, 0.15, 0.85 * arm.lengths[1], 0.38, 0.38, f"Forearm{tag}", taper=0.9)
|
||||
SL.dress("Forearm", fore, arm.lengths[1], s, seed=22)
|
||||
if s > 0:
|
||||
SB.laser(fore, arm.lengths[1], s)
|
||||
else:
|
||||
|
|
@ -172,7 +191,6 @@ if AT >= 3:
|
|||
r = float(wr["kit_roll"])
|
||||
arm.records.append(legplan.record(wr, r - 50, r + 50, "wrist_pitch"))
|
||||
SB.manipulator(wr, s)
|
||||
SB.shin_plate(fore, arm.lengths[1], s, f"Forearm{tag}", front=0.24, width=0.2)
|
||||
REPORT["arms"].append(arm.report())
|
||||
freeze_all()
|
||||
|
||||
|
|
@ -185,14 +203,14 @@ for tag, s in (("r", 1), ("l", -1)):
|
|||
points[f"sole.{tag}"] = list(SF.design_points()[f"sole.{tag}"]) # the footprint's middle: the ankle 0.25 m forward, on the ground
|
||||
if tag in SB.BATTERY_FACES:
|
||||
points[f"battery.{tag}"] = [round(float(c), 4) for c in tw @ SB.BATTERY_FACES[tag]]
|
||||
(OUT / ("stag_points.json" if POSE == "stance" else "stag_points_hero.json")).write_text(json.dumps(points, indent=1), encoding="utf-8")
|
||||
(OUT / f"stag_points{SUFFIX}.json").write_text(json.dumps(points, indent=1), encoding="utf-8")
|
||||
REPORT["kinds"] = SF.KINDS
|
||||
REPORT["hard"] = SB.HARD
|
||||
lo, hi = M.bounds()
|
||||
print("HEIGHT", round(hi.z - lo.z, 2), "LOW", round(lo.z, 2), "WIDTH", round(hi.x - lo.x, 2), "DEPTH", round(hi.y - lo.y, 2), "stage", STAGE, "build s", round(time.time() - t0, 1), flush=True)
|
||||
REPORT["cages"] = CK.CAGES
|
||||
REPORT["bounds"] = {"lo": [round(c, 3) for c in lo], "hi": [round(c, 3) for c in hi]}
|
||||
(OUT / ("stag_report.json" if POSE == "stance" else "stag_report_hero.json")).write_text(json.dumps(REPORT, indent=1, default=str), encoding="utf-8")
|
||||
(OUT / f"stag_report{SUFFIX}.json").write_text(json.dumps(REPORT, indent=1, default=str), encoding="utf-8")
|
||||
|
||||
# --- the built skeleton against the marks ---------------------------------------------------------------------------
|
||||
built = {}
|
||||
|
|
@ -203,7 +221,7 @@ for tag, leg in legs.items():
|
|||
built[f"{name}_{k}"] = M.sockets(seg)["clevis"].translation
|
||||
built["waist"] = TORSO.matrix_world.translation
|
||||
skel = {k: [round(float(c), 4) for c in v] for k, v in built.items()}
|
||||
(OUT / ("stag_skeleton.json" if POSE == "stance" else "stag_skeleton_hero.json")).write_text(json.dumps({"built": skel, "design": {k: list(v) for k, v in J.items()}}, indent=1), encoding="utf-8")
|
||||
(OUT / f"stag_skeleton{SUFFIX}.json").write_text(json.dumps({"built": skel, "design": {k: list(v) for k, v in J.items()}}, indent=1), encoding="utf-8")
|
||||
print("SKELETON miss", {k: round((Vector(v) - Vector(J[k])).length, 3) for k, v in skel.items() if k in J}, flush=True)
|
||||
|
||||
# --- views ---------------------------------------------------------------------------------------------------------
|
||||
|
|
@ -212,6 +230,11 @@ cams = SF.cameras()
|
|||
rig, cam, centre, radius = M.stage_field(8 if QUICK else int(os.environ.get("MECH_SAMPLES", 48)))
|
||||
ground = lo.z
|
||||
paint.apply(os.environ.get("STAG_PAINT", "mcr3"), ground=ground)
|
||||
visor = paint.glass("paint_glass_visor", "visor_amber") # the recessed cockpit's lit amber visor
|
||||
for o in bpy.context.scene.objects:
|
||||
for slot in getattr(o, "material_slots", []):
|
||||
if slot.material and slot.material.name == "visor":
|
||||
slot.material = visor
|
||||
scene = bpy.context.scene
|
||||
W = 1000 if QUICK else 1500
|
||||
ARRAYS = lambda name: name.startswith(("ArrayR", "ArrayL")) # noqa: E731
|
||||
|
|
@ -225,7 +248,7 @@ def view(tag, stem, width, box=None):
|
|||
M.shot(rig, cam, radius, 0, 0, OUT / f"{stem}.png", (width, width), solved=cams[tag], box=box)
|
||||
|
||||
|
||||
VIEWS = ("hero",) if POSE == "hero" else ("rear3q", "rear", "side", "inset")
|
||||
VIEWS = (POSE,) if SOLVED else ("rear", "side", "inset")
|
||||
for tag in [t for t in VIEWS if t in cams]:
|
||||
if tag in ("hero", "rear3q"):
|
||||
M.silhouette(rig, cam, radius, 0, 0, OUT / f"{STAGE}_sil_{tag}.png", (cams[tag]["box"][2] - cams[tag]["box"][0], 0), solved=cams[tag])
|
||||
|
|
|
|||
|
|
@ -7,8 +7,9 @@ Mass first (mech-pass2-common): torso_mass is one closed solid, the chest's weig
|
|||
silhouettes before any plate; it stays as the dark core. Pass 3: the upper torso's armour is hard plates written by
|
||||
their faces (hull(): massing.hard on stag_form.HULL, Bastion pass 2's method), detail panels stepped and bolted on
|
||||
their large facets: the 37 shells, the keel and its ridge, the brow over the recessed cockpit, its cap, the chin.
|
||||
Free cages (cagekit, brokkr_kitbash.shell) stay where the concept curves: the flanks, the dorsal module's cover, the
|
||||
thigh shields, the upper arms' shells; and the hard limb plates with every edge creased.
|
||||
Free cages (cagekit, brokkr_kitbash.shell) stay where the concept curves: the flanks and the dorsal module's cover.
|
||||
Pass 4: the limbs' armour is stag_limbs.py's (hard plates by their faces); here only the joints' drums, the lower
|
||||
legs' bare rams, the shoulder, the hand and the laser.
|
||||
"""
|
||||
import math
|
||||
|
||||
|
|
@ -146,18 +147,22 @@ def numerals(frame):
|
|||
|
||||
|
||||
def cockpit(frame):
|
||||
"""COCKPIT inset ("RECESSED COCKPIT"): deep under the brow, a dark well between the breast shells, the amber
|
||||
canopy a long slit set back 0.3 m behind the brow's lip in a framed visor; the chin plate under it is hull()'s."""
|
||||
if "amber_canopy" not in M.MATS:
|
||||
M.material("amber_canopy", (0.05, 0.025, 0.0), 0.2, 0.12, emission=((1.0, 0.42, 0.0), 1.2), coat=1.0)
|
||||
"""COCKPIT inset ("RECESSED COCKPIT") and the hero: deep under the brow, a dark well between the breast shells, the
|
||||
amber visor a wide band set back under the brow's lip in a framed recess, sloped to face forward and down so a
|
||||
viewer below the head sees it under the lip; it glows (paint.GLASS "visor_amber", stag.py). Pass 3's visor was a
|
||||
slit 0.085 m tall under an unlit canopy material, and barely showed at figure scale."""
|
||||
if "visor" not in M.MATS: # the Workbench preview's stand-in: stag.py paints it a MechGlass before a render
|
||||
M.material("visor", (0.06, 0.025, 0.002), 0.0, 0.15, emission=((1.0, 0.42, 0.06), 2.2))
|
||||
by = 1.5
|
||||
b = M.Build("Cockpit", frame, Matrix.Identity(4))
|
||||
d = b[CORE]
|
||||
d.hull([(s * x, y, z) for s in (-1, 1) for x, y, z in ((0.5, 0.4, 1.3), (0.5, 0.4, 1.7), (0.46, by - 0.24, 1.5), (0.46, by - 0.2, 1.68))])
|
||||
y = by - 0.3
|
||||
b["amber_canopy"].hull([(s * x, yy, z) for s in (-1, 1) for x, yy, z in ((0.44, y, 1.58), (0.44, y + 0.02, 1.665), (0.4, y + 0.06, 1.62))])
|
||||
d.hull([(s * x, y, z) for s in (-1, 1) for x, y, z in ((0.62, 0.4, 1.36), (0.62, 0.4, 1.72), (0.6, by - 0.36, 1.4), (0.6, by - 0.2, 1.7))])
|
||||
v = b["visor"]
|
||||
v.hull([(s * x, y, z) for s in (-1, 1) for x, y, z in ((0.5, 1.33, 1.43), (0.56, 1.25, 1.64), (0.5, 1.29, 1.43), (0.56, 1.21, 1.64))])
|
||||
for s in (-1, 1):
|
||||
b[PLATE].box(T((s * 0.24, y + 0.06, 1.62)), (0.03, 0.05, 0.1)) # the canopy's frame posts
|
||||
b[PLATE].box(T((s * 0.2, 1.31, 1.535)) @ Matrix.Rotation(math.radians(-25), 4, "X"), (0.035, 0.04, 0.24)) # the visor's frame posts
|
||||
b[PLATE].hull([(s * x, y, z) for x, y, z in ((0.54, 1.36, 1.42), (0.62, 1.36, 1.42), (0.6, 1.26, 1.66), (0.66, 1.26, 1.66),
|
||||
(0.54, 1.2, 1.42), (0.62, 1.2, 1.42), (0.6, 1.1, 1.66), (0.66, 1.1, 1.66))]) # the recess's cheeks
|
||||
return b.done(bevel=0.01)
|
||||
|
||||
|
||||
|
|
@ -258,32 +263,6 @@ def pylon_seats(frame):
|
|||
|
||||
# --- limbs: dress on kit links -----------------------------------------------------------------------------------
|
||||
|
||||
def limb_frame(link, origin_z, side, outboard=1):
|
||||
"""mechlib.seat on a link: a component drawn upright (x its outboard side for a right part, y front, z up) at
|
||||
`origin_z` along the link. Mirrored for the left side."""
|
||||
return M.seat(link, (0, 0, origin_z), outboard=outboard, side=side)
|
||||
|
||||
|
||||
def thigh_shield(link, length, side, tag):
|
||||
"""Hero view: the thigh's big shield, a long oval shell over its front and outer side, widest at mid-thigh,
|
||||
its outer front corner a crease down its length. Free cage 4 x 4."""
|
||||
cols = [(-0.26, 0.38), (0.1, 0.46), (0.42, 0.26), (0.46, -0.3)]
|
||||
rows = CK.rect_rows([(0.5 * length, 0.72, -0.08), (0.2 * length, 0.95, 0.02), (-0.2 * length, 0.92, 0.01), (-0.5 * length + 0.08, 0.64, -0.1)], cols)
|
||||
sheet = CK.grid(rows, crease_cols=[(2, 0.8)])
|
||||
sheet["rim"] = 1.0
|
||||
b = M.Build(f"{tag}.Shield", link, limb_frame(link, 0.5 * length, side))
|
||||
return [CK.shell(f"{tag}.Shield", sheet, b, PLATE, thickness=0.07, levels=2, bevel=0.015, inside=(0.0, 0.0, 0.0))]
|
||||
|
||||
|
||||
def shin_plate(link, length, side, tag, front=0.34, width=0.3):
|
||||
"""Hero view, hard: a front plate down a lower leg link, ridged. Free cage 3 x 3, every edge a facet."""
|
||||
cols = [(-width, front - 0.12), (0.0, front), (width, front - 0.12)]
|
||||
rows = CK.rect_rows([(0.42 * length, 0.9, 0.0), (0.0, 1.0, 0.03), (-0.42 * length, 0.8, -0.02)], cols)
|
||||
sheet = hard(CK.grid(rows)) # stag_form.KINDS["Plate"]: a ridge and two flat faces
|
||||
b = M.Build(f"{tag}.Plate", link, limb_frame(link, 0.5 * length, side))
|
||||
return [CK.shell(f"{tag}.Plate", sheet, b, PLATE, thickness=0.05, levels=2, bevel=0.012, inside=(0.0, 0.0, 0.0))]
|
||||
|
||||
|
||||
def knee(link, side, tag, r=0.36, width=0.7):
|
||||
"""A joint's drum on a link's tongue pin, capped both sides, and a cap plate over its front."""
|
||||
b = M.Build(f"{tag}.Drum", link, Matrix.Identity(4))
|
||||
|
|
@ -300,22 +279,13 @@ def lower_rams(link, length, side, tag):
|
|||
fr = M.local_dir(link, (0, 1, 0))
|
||||
back = -1 if fr.y > 0 else 1
|
||||
for x in (-0.12, 0.12):
|
||||
b[CORE].cylinder(F((x, back * 0.26, 0.35 * length), (0, 0, 1)), 0.07, 0.5 * length, 16)
|
||||
b["steel"].rod((x, back * 0.26, 0.6 * length), (x, back * 0.26, 0.9 * length), 0.035, 12)
|
||||
b[CORE].box(T((x, back * 0.2, 0.08 * length)), (0.1, 0.16, 0.12))
|
||||
b[CORE].cylinder(F((x, back * 0.34, 0.35 * length), (0, 0, 1)), 0.075, 0.5 * length, 16)
|
||||
b["steel"].rod((x, back * 0.34, 0.6 * length), (x, back * 0.34, 0.9 * length), 0.038, 12)
|
||||
b[CORE].box(T((x, back * 0.28, 0.08 * length)), (0.1, 0.2, 0.12))
|
||||
b[CORE].box(T((x, back * 0.3, 0.92 * length)), (0.1, 0.16, 0.1))
|
||||
return b.done()
|
||||
|
||||
|
||||
def upper_arm(link, length, side, tag):
|
||||
"""Hero view: the short upper arm's shell over its front and outer side. Free cage 3 x 3."""
|
||||
cols = [(-0.2, 0.26), (0.18, 0.28), (0.3, -0.12)]
|
||||
rows = CK.rect_rows([(0.38 * length, 1.0, 0.0), (0.0, 1.08, 0.02), (-0.34 * length, 0.86, -0.02)], cols)
|
||||
sheet = CK.grid(rows, crease_cols=[(1, 0.7)])
|
||||
sheet["rim"] = 1.0
|
||||
b = M.Build(f"{tag}.Shell", link, limb_frame(link, 0.5 * length, side))
|
||||
return [CK.shell(f"{tag}.Shell", sheet, b, PLATE, thickness=0.05, levels=2, bevel=0.012, inside=(0.0, 0.0, 0.0))]
|
||||
|
||||
|
||||
def shoulder(frame, side):
|
||||
"""Hero view: the shoulder's bearing drum under the breast shell, out of the chest's flank."""
|
||||
x, y, z = SF.TORSO["shoulder"]
|
||||
|
|
@ -360,16 +330,3 @@ def laser(fore, length, side):
|
|||
build = M.Build("Laser", fore, m)
|
||||
weapons_energy.stag_laser(build, size="M", length=length / 0.8 * 0.9)
|
||||
return build.done()
|
||||
|
||||
|
||||
def limb_block(link, z0, z1, w, d, tag, mat="olive", taper=0.85):
|
||||
"""Hero view: the armoured bulk round a limb link, a chamfered octagonal block from z0 to z1 along it (the
|
||||
link's frame), narrowing by `taper` toward z1: what reads as the leg's mass under the shields and plates."""
|
||||
b = M.Build(f"{tag}.Block", link, Matrix.Identity(4))
|
||||
pts = []
|
||||
for z, k in ((z0, 1.0), (z1, taper)):
|
||||
a, c = 0.5 * w * k, 0.5 * d * k
|
||||
q = 0.3 * min(a, c)
|
||||
pts += [(sx * a, sy * (c - q), z) for sx in (-1, 1) for sy in (-1, 1)] + [(sx * (a - q), sy * c, z) for sx in (-1, 1) for sy in (-1, 1)]
|
||||
b[mat].hull(pts)
|
||||
return b.done(bevel=0.02)
|
||||
|
|
|
|||
|
|
@ -244,31 +244,31 @@
|
|||
},
|
||||
"hero": {
|
||||
"C": [
|
||||
3.9055097345214302,
|
||||
8.3753926541803,
|
||||
1.303432414597535
|
||||
3.9475399555395483,
|
||||
8.465526754028309,
|
||||
1.3762675094572756
|
||||
],
|
||||
"R": [
|
||||
[
|
||||
-0.9064737585441767,
|
||||
0.4074505721694987,
|
||||
-0.11085736921622212
|
||||
-0.9069966544317917,
|
||||
0.4127254420876277,
|
||||
-0.08375427334237544
|
||||
],
|
||||
[
|
||||
-0.04930669828440091,
|
||||
0.15860183766096536,
|
||||
0.9861106969275083
|
||||
-0.03010671278026926,
|
||||
0.13482225696967712,
|
||||
0.9904123105410032
|
||||
],
|
||||
[
|
||||
0.4193735501615293,
|
||||
0.8993494806410426,
|
||||
-0.12367836146878064
|
||||
0.4200602988799387,
|
||||
0.9008222180203896,
|
||||
-0.10985752967239859
|
||||
]
|
||||
],
|
||||
"f": 718.0555555555555,
|
||||
"c": [
|
||||
299.37906696871664,
|
||||
546.5461005949476
|
||||
292.95308427627737,
|
||||
555.459579911472
|
||||
],
|
||||
"box": [
|
||||
0,
|
||||
|
|
@ -277,13 +277,13 @@
|
|||
790
|
||||
],
|
||||
"azimuth": -24.999999999,
|
||||
"distance": 9.24122331718799,
|
||||
"distance": 9.340675292705033,
|
||||
"lens": 55.0,
|
||||
"unit": 1024,
|
||||
"rms": 14.658338518286971,
|
||||
"elevation": 7.104439232007342,
|
||||
"roll": -6.414191729245742,
|
||||
"horizon": 635.4809319919307,
|
||||
"rms": 14.90781427209614,
|
||||
"elevation": 6.307102847411103,
|
||||
"roll": -4.833720363785091,
|
||||
"horizon": 634.5414899586301,
|
||||
"model": "posed",
|
||||
"marks": [
|
||||
"shoulder_r",
|
||||
|
|
@ -310,380 +310,302 @@
|
|||
],
|
||||
"residuals": {
|
||||
"shoulder_r": [
|
||||
6.487623107485831,
|
||||
5.9186942870026655
|
||||
7.778507535624669,
|
||||
5.349425089803219
|
||||
],
|
||||
"elbow_r": [
|
||||
4.564279338113636,
|
||||
9.436176650524942
|
||||
5.224078786139216,
|
||||
9.46108918297358
|
||||
],
|
||||
"wrist_r": [
|
||||
-2.8909203509544454,
|
||||
-3.2901074712550553
|
||||
-3.276750059741886,
|
||||
-3.250575928119929
|
||||
],
|
||||
"shoulder_l": [
|
||||
10.379059055880873,
|
||||
9.66956549334327
|
||||
12.15448872466601,
|
||||
9.333906205095502
|
||||
],
|
||||
"elbow_l": [
|
||||
9.88028974669163,
|
||||
8.403873031187004
|
||||
10.959167671073601,
|
||||
8.384279486299988
|
||||
],
|
||||
"wrist_l": [
|
||||
-4.213013054208602,
|
||||
-2.238062613479997
|
||||
-4.826174007791678,
|
||||
-2.279979165535167
|
||||
],
|
||||
"waist": [
|
||||
-22.4928001017376,
|
||||
20.30312555288066
|
||||
-23.52832917102063,
|
||||
20.087672485696544
|
||||
],
|
||||
"hip_r": [
|
||||
-12.251078217149086,
|
||||
17.4603089997255
|
||||
-14.165958370384288,
|
||||
16.229867052348993
|
||||
],
|
||||
"hip_l": [
|
||||
-4.645443211220311,
|
||||
24.018426256467137
|
||||
-7.248176911022142,
|
||||
24.829838598632932
|
||||
],
|
||||
"knee_r": [
|
||||
3.9887231877819715,
|
||||
-10.810423130529784
|
||||
4.527521925435451,
|
||||
-11.282413895626007
|
||||
],
|
||||
"knee_l": [
|
||||
-8.086853779741375,
|
||||
-9.465667546592101
|
||||
-9.394223526999724,
|
||||
-11.612392155416956
|
||||
],
|
||||
"hock_r": [
|
||||
-5.344133162996684,
|
||||
-8.552864449403728
|
||||
-0.8569691753176869,
|
||||
-7.139953621492737
|
||||
],
|
||||
"hock_l": [
|
||||
-0.43770734797931254,
|
||||
-9.284024772058274
|
||||
-1.7364502960860477,
|
||||
-9.898090849081655
|
||||
],
|
||||
"ankle_r": [
|
||||
-6.734563881301966,
|
||||
-2.244932543644154
|
||||
-6.867829423114955,
|
||||
2.2462591072769555
|
||||
],
|
||||
"ankle_l": [
|
||||
0.5427656004009123,
|
||||
-10.094623832751495
|
||||
1.3425437684389294,
|
||||
-12.702163314946915
|
||||
],
|
||||
"brow.r": [
|
||||
1.5615299118437918,
|
||||
-5.281347075299152
|
||||
0.47288294909500905,
|
||||
-5.08407689629604
|
||||
],
|
||||
"brow.l": [
|
||||
20.460955549294965,
|
||||
-10.892914383364086
|
||||
20.204495491018406,
|
||||
-11.408610534287845
|
||||
],
|
||||
"sole.r": [
|
||||
13.235196276759325,
|
||||
2.1420503896027867
|
||||
11.498788585452303,
|
||||
3.9114908603519325
|
||||
],
|
||||
"sole.l": [
|
||||
3.7944138795383537,
|
||||
4.449531856963517
|
||||
3.486156484237995,
|
||||
2.5804416396199485
|
||||
],
|
||||
"n37.r": [
|
||||
-14.343365249068881,
|
||||
-13.642148844282303
|
||||
-12.251041355865539,
|
||||
-12.274067333029052
|
||||
],
|
||||
"n37.l": [
|
||||
6.545046132616449,
|
||||
-9.874852173560896
|
||||
6.503270188457861,
|
||||
-9.11731809267934
|
||||
]
|
||||
},
|
||||
"solved": {
|
||||
"pose": {
|
||||
"torso_yaw": -10.939220062095854,
|
||||
"torso_pitch": -1e-09,
|
||||
"drop": -0.1642416677290892,
|
||||
"hip_abd_r": 16.25363269180241,
|
||||
"hip_flex_r": -17.762119195056766,
|
||||
"knee_r": 33.57689698565213,
|
||||
"hock_r": -24.95260508583792,
|
||||
"hip_abd_l": -13.324954970649845,
|
||||
"hip_flex_l": -10.40992675694322,
|
||||
"knee_l": 23.103346141750585,
|
||||
"hock_l": -18.440719138757302,
|
||||
"sh_flex_r": 25.072210960562682,
|
||||
"sh_abd_r": 3.2094099697616016,
|
||||
"elbow_r": -24.794568268804916,
|
||||
"sh_flex_l": 13.442396607461477,
|
||||
"sh_abd_l": -7.809833194197419,
|
||||
"elbow_l": -4.863487106721294
|
||||
"torso_yaw": -13.626717063516372,
|
||||
"torso_pitch": 1e-09,
|
||||
"drop": -0.24743493507923262,
|
||||
"hip_abd_r": 13.692341933468938,
|
||||
"hip_flex_r": -18.494454681633606,
|
||||
"knee_r": 40.576114435692396,
|
||||
"hip_abd_l": -12.723322975032216,
|
||||
"hip_flex_l": -7.18602103545825,
|
||||
"knee_l": 23.388146862580616,
|
||||
"sh_flex_r": 25.149429178022288,
|
||||
"sh_abd_r": 1.8396727519702571,
|
||||
"elbow_r": -24.941795766277526,
|
||||
"sh_flex_l": 13.794670743859536,
|
||||
"sh_abd_l": -6.642851181407459,
|
||||
"elbow_l": -4.525582425716295,
|
||||
"hock_r": -47.098553232158785,
|
||||
"hock_l": -18.090011060079213
|
||||
},
|
||||
"joints": {
|
||||
"waist": [
|
||||
0.0,
|
||||
0.0,
|
||||
5.481975657876872
|
||||
5.565168925227016
|
||||
],
|
||||
"hip_r": [
|
||||
0.5652709359605912,
|
||||
0.0,
|
||||
4.853896840142882
|
||||
4.937090107493026
|
||||
],
|
||||
"knee_r": [
|
||||
1.2265629756277283,
|
||||
-0.045209947982837555,
|
||||
3.1840476019514434
|
||||
1.1511086431506747,
|
||||
-0.0680617792899095,
|
||||
3.2400605395578
|
||||
],
|
||||
"hock_r": [
|
||||
1.6848521244881123,
|
||||
-0.6173654855496296,
|
||||
2.0609039856969513
|
||||
1.5718261255833983,
|
||||
-0.5050943168692087,
|
||||
2.0438825231500375
|
||||
],
|
||||
"ankle_r": [
|
||||
2.118330089548047,
|
||||
-0.23808835002637577,
|
||||
0.79846148443246
|
||||
1.9609757999304969,
|
||||
-0.5050943168692077,
|
||||
0.7119373697455442
|
||||
],
|
||||
"sole.r": [
|
||||
2.118330089548047,
|
||||
0.011911649973624233,
|
||||
0.08663882433393788
|
||||
1.9609757999304969,
|
||||
-0.2550943168692077,
|
||||
0.00011470964702209319
|
||||
],
|
||||
"shoulder_r": [
|
||||
1.1922209810074704,
|
||||
-0.23043204717215846,
|
||||
6.570645608615789
|
||||
1.180105086831154,
|
||||
-0.2860800236884797,
|
||||
6.653838875965932
|
||||
],
|
||||
"elbow_r": [
|
||||
1.6813915019717827,
|
||||
0.0884058216373705,
|
||||
5.441656111052459
|
||||
1.6576911515479287,
|
||||
0.017368073156794884,
|
||||
5.515685338834353
|
||||
],
|
||||
"wrist_r": [
|
||||
1.925890026699291,
|
||||
0.49445357358509817,
|
||||
4.404501508124433
|
||||
1.8965361669141683,
|
||||
0.41611203160552457,
|
||||
4.4743879317186614
|
||||
],
|
||||
"brow.r": [
|
||||
1.0087291410314305,
|
||||
1.1087224720175448,
|
||||
7.211975657899213
|
||||
1.0596059748880424,
|
||||
1.0602052527972394,
|
||||
7.295168925204676
|
||||
],
|
||||
"n37.r": [
|
||||
1.1690391117036676,
|
||||
0.8842214401711814,
|
||||
6.7619756578958965
|
||||
1.2036171088139065,
|
||||
0.932687437151535,
|
||||
6.765168925206247
|
||||
],
|
||||
"battery.r": [
|
||||
0.6655773402500221,
|
||||
-1.4990019359736262,
|
||||
7.615168925249705
|
||||
],
|
||||
"hip_l": [
|
||||
-0.5652709359605912,
|
||||
0.0,
|
||||
4.853896840142882
|
||||
4.937090107493026
|
||||
],
|
||||
"knee_l": [
|
||||
-0.3181723032041216,
|
||||
0.18399403906210932,
|
||||
3.0839149084012734
|
||||
-0.339670354607026,
|
||||
0.28376621258438567,
|
||||
3.177451311120114
|
||||
],
|
||||
"hock_l": [
|
||||
-0.1699271238146255,
|
||||
-0.4530091804438822,
|
||||
1.9129782102866764
|
||||
-0.1956268746218371,
|
||||
-0.2802196054447993,
|
||||
1.9691409375817397
|
||||
],
|
||||
"ankle_l": [
|
||||
0.07054130842788409,
|
||||
0.0044578981666695775,
|
||||
0.6251839076884202
|
||||
0.02387093224487402,
|
||||
0.26428642997584817,
|
||||
0.7118226600985222
|
||||
],
|
||||
"sole.l": [
|
||||
0.07054130842788409,
|
||||
0.2544578981666696,
|
||||
-0.08663875241010188
|
||||
0.02387093224487402,
|
||||
0.5142864299758482,
|
||||
1.1102230246251565e-16
|
||||
],
|
||||
"shoulder_l": [
|
||||
-1.192220981014682,
|
||||
0.23043204713484725,
|
||||
6.570645608615789
|
||||
-1.1801050868222012,
|
||||
0.2860800237254117,
|
||||
6.653838875965932
|
||||
],
|
||||
"elbow_l": [
|
||||
-1.3457148713107534,
|
||||
0.42873318885619827,
|
||||
5.324580219637512
|
||||
-1.3471241281864272,
|
||||
0.5045787011840305,
|
||||
5.412901472812006
|
||||
],
|
||||
"wrist_l": [
|
||||
-1.2060024743368551,
|
||||
1.0039009528583527,
|
||||
4.349897468576895
|
||||
-1.197961660799523,
|
||||
1.0887442705212984,
|
||||
4.444993873010022
|
||||
],
|
||||
"brow.l": [
|
||||
-0.5229241663380936,
|
||||
1.4047598784782802,
|
||||
7.211975657899213
|
||||
-0.45648197195281903,
|
||||
1.4277339420772215,
|
||||
7.295168925204676
|
||||
],
|
||||
"n37.l": [
|
||||
-0.7553458129400932,
|
||||
1.2561658739295414,
|
||||
6.7619756578958965
|
||||
-0.6429002623384245,
|
||||
1.3803185330694618,
|
||||
6.765168925206247
|
||||
],
|
||||
"battery.l": [
|
||||
-1.2781251556998,
|
||||
-1.027811308691598,
|
||||
7.615168925249705
|
||||
]
|
||||
},
|
||||
"torso": {
|
||||
"R": [
|
||||
[
|
||||
0.9818290431855923,
|
||||
0.18976756824406119,
|
||||
-3.3120688793619025e-12
|
||||
0.9718512479749111,
|
||||
0.2355953136410141,
|
||||
4.111913925304406e-12
|
||||
],
|
||||
[
|
||||
-0.18976756824406119,
|
||||
0.9818290431855923,
|
||||
-1.7136149495294184e-11
|
||||
-0.2355953136410141,
|
||||
0.9718512479749111,
|
||||
1.6962004116778075e-11
|
||||
],
|
||||
[
|
||||
0.0,
|
||||
1.7453292519943298e-11,
|
||||
-1.7453292519943298e-11,
|
||||
1.0
|
||||
]
|
||||
],
|
||||
"waist": [
|
||||
0.0,
|
||||
0.0,
|
||||
5.481975657876872
|
||||
5.565168925227016
|
||||
]
|
||||
},
|
||||
"stance_rms": 25.25836443098684,
|
||||
"scan": {
|
||||
"35": 17.813022640524103,
|
||||
"42": 16.23617059206162,
|
||||
"55": 14.658338518286971,
|
||||
"70": 13.874354268463915
|
||||
"35": 18.125023694975074,
|
||||
"42": 16.559725084699913,
|
||||
"55": 14.90781427209614,
|
||||
"70": 14.000242600076593
|
||||
}
|
||||
}
|
||||
},
|
||||
"rear3q": {
|
||||
"C": [
|
||||
-0.7802415318819605,
|
||||
-6.101949425694438,
|
||||
2.287237985833952
|
||||
-5.7775894321905605,
|
||||
-6.885462962591493,
|
||||
1.6504451154940785
|
||||
],
|
||||
"R": [
|
||||
[
|
||||
0.9898935684946091,
|
||||
-0.14026460516540398,
|
||||
-0.020894104211520714
|
||||
0.7634204684632179,
|
||||
-0.6450167603476676,
|
||||
0.03380188163402465
|
||||
],
|
||||
[
|
||||
-0.01890823378129857,
|
||||
-0.2765657219676307,
|
||||
0.9608089717148747
|
||||
-0.09021077184444627,
|
||||
-0.05465815389497471,
|
||||
0.9944216926716868
|
||||
],
|
||||
[
|
||||
-0.14054608407309085,
|
||||
-0.9507035510453911,
|
||||
-0.27642278538753484
|
||||
-0.6395711101782431,
|
||||
-0.7622111683014051,
|
||||
-0.09991461325540357
|
||||
]
|
||||
],
|
||||
"f": 439.1666666666667,
|
||||
"f": 602.7777777777778,
|
||||
"c": [
|
||||
585.0,
|
||||
440.0
|
||||
568.2297896650625,
|
||||
556.4711562125914
|
||||
],
|
||||
"box": [
|
||||
430.0,
|
||||
90.0,
|
||||
740.0,
|
||||
790.0
|
||||
430,
|
||||
90,
|
||||
740,
|
||||
790
|
||||
],
|
||||
"lens": 51.0,
|
||||
"lens_band": [
|
||||
51.0,
|
||||
51.0
|
||||
],
|
||||
"lens_at_bound": null,
|
||||
"lens_determined": null,
|
||||
"planarity": 0.19862415641847384,
|
||||
"rms": 25.801827464127516,
|
||||
"median": 17.792920874930637,
|
||||
"worst": [
|
||||
"battery.r",
|
||||
57.9419090320407
|
||||
],
|
||||
"left_out": 33.92647083442346,
|
||||
"model": "rolled",
|
||||
"tried": {
|
||||
"rolled": {
|
||||
"rms": 25.801827464127516,
|
||||
"left_out": 33.92647083442346,
|
||||
"lens": 51.0
|
||||
}
|
||||
},
|
||||
"azimuth": 173.56131040229633,
|
||||
"elevation": -18.55625118138831,
|
||||
"distance": 6.354640068030173,
|
||||
"roll": -1.245778677356766,
|
||||
"twist": 0.0,
|
||||
"plane": null,
|
||||
"residuals": {
|
||||
"shoulder_l": [
|
||||
15.431188336156765,
|
||||
-5.458315048451141
|
||||
],
|
||||
"elbow_l": [
|
||||
4.220840113051679,
|
||||
-7.280468136709715
|
||||
],
|
||||
"wrist_l": [
|
||||
-8.445465012040756,
|
||||
18.235625893548615
|
||||
],
|
||||
"shoulder_r": [
|
||||
-14.202713865197893,
|
||||
4.21125641894389
|
||||
],
|
||||
"elbow_r": [
|
||||
8.88073455666472,
|
||||
17.673495416835976
|
||||
],
|
||||
"waist": [
|
||||
15.365847139766743,
|
||||
11.54176099474114
|
||||
],
|
||||
"hip_l": [
|
||||
16.170586569033276,
|
||||
1.2442728899811186
|
||||
],
|
||||
"hip_r": [
|
||||
12.90127002599445,
|
||||
3.763214260717291
|
||||
],
|
||||
"knee_l": [
|
||||
25.41663153102172,
|
||||
-6.144280484195178
|
||||
],
|
||||
"knee_r": [
|
||||
-19.49563538654411,
|
||||
-11.58983756615362
|
||||
],
|
||||
"hock_l": [
|
||||
2.416594348985882,
|
||||
-3.422882308771932
|
||||
],
|
||||
"hock_r": [
|
||||
0.8369246562144781,
|
||||
-7.0590412425748355
|
||||
],
|
||||
"ankle_l": [
|
||||
-3.3769965320499864,
|
||||
12.799010510953963
|
||||
],
|
||||
"ankle_r": [
|
||||
-42.41824870447158,
|
||||
2.2781371334604046
|
||||
],
|
||||
"battery.l": [
|
||||
-35.60875331389485,
|
||||
-24.785135246587288
|
||||
],
|
||||
"battery.r": [
|
||||
-53.97793486693945,
|
||||
-21.06293829876833
|
||||
]
|
||||
},
|
||||
"azimuth": 140.000000001,
|
||||
"distance": 8.98833354166273,
|
||||
"lens": 70.0,
|
||||
"unit": 1024,
|
||||
"rms": 19.015760509577945,
|
||||
"elevation": 5.734253551868922,
|
||||
"roll": 1.9468197288495241,
|
||||
"horizon": 616.9654138356351,
|
||||
"model": "posed",
|
||||
"marks": [
|
||||
"shoulder_l",
|
||||
"elbow_l",
|
||||
|
|
@ -701,7 +623,241 @@
|
|||
"ankle_r",
|
||||
"battery.l",
|
||||
"battery.r"
|
||||
]
|
||||
],
|
||||
"residuals": {
|
||||
"shoulder_l": [
|
||||
18.348970371620112,
|
||||
-15.321772914688665
|
||||
],
|
||||
"elbow_l": [
|
||||
10.418246022978622,
|
||||
-1.4726671043603687
|
||||
],
|
||||
"wrist_l": [
|
||||
-8.619842568096999,
|
||||
4.052567751037259
|
||||
],
|
||||
"shoulder_r": [
|
||||
-13.92135097008736,
|
||||
13.381930315608031
|
||||
],
|
||||
"elbow_r": [
|
||||
1.8672015403461728,
|
||||
5.3472168595087055
|
||||
],
|
||||
"waist": [
|
||||
14.686531435681218,
|
||||
21.519479847350794
|
||||
],
|
||||
"hip_l": [
|
||||
22.345008063281966,
|
||||
4.295973078733709
|
||||
],
|
||||
"hip_r": [
|
||||
0.1751082828457129,
|
||||
22.71078543975227
|
||||
],
|
||||
"knee_l": [
|
||||
4.446101327561053,
|
||||
-11.356920380514396
|
||||
],
|
||||
"knee_r": [
|
||||
-12.922565504244062,
|
||||
-1.934442621451808
|
||||
],
|
||||
"hock_l": [
|
||||
4.953839687809818,
|
||||
-5.667857253890475
|
||||
],
|
||||
"hock_r": [
|
||||
16.58628753016444,
|
||||
5.462271425010613
|
||||
],
|
||||
"ankle_l": [
|
||||
-3.8454389288178845,
|
||||
1.2492702524386914
|
||||
],
|
||||
"ankle_r": [
|
||||
-11.31329263034047,
|
||||
-2.367769936231298
|
||||
],
|
||||
"battery.l": [
|
||||
-9.198286582258675,
|
||||
-28.328782069748627
|
||||
],
|
||||
"battery.r": [
|
||||
-34.00651690982795,
|
||||
-4.560636147383093
|
||||
]
|
||||
},
|
||||
"solved": {
|
||||
"pose": {
|
||||
"torso_yaw": -23.101834648883017,
|
||||
"torso_pitch": -1e-09,
|
||||
"drop": -0.1915789603457089,
|
||||
"hip_abd_r": 16.91769344955028,
|
||||
"hip_flex_r": -15.978691076113108,
|
||||
"knee_r": 42.40752762019342,
|
||||
"hip_abd_l": -3.685453853081447,
|
||||
"hip_flex_l": 11.083633181147107,
|
||||
"knee_l": 5.095692949598743,
|
||||
"sh_flex_r": -31.115648076960525,
|
||||
"sh_abd_r": -17.591056801532847,
|
||||
"elbow_r": 0.0,
|
||||
"sh_flex_l": 19.792518880760287,
|
||||
"sh_abd_l": -3.9910364412123767,
|
||||
"elbow_l": 14.781171014403927,
|
||||
"hock_r": -51.44573002218029,
|
||||
"hock_l": -29.384172938041566
|
||||
},
|
||||
"joints": {
|
||||
"waist": [
|
||||
0.0,
|
||||
0.0,
|
||||
5.5093129504934915
|
||||
],
|
||||
"hip_r": [
|
||||
0.5652709359605912,
|
||||
0.0,
|
||||
4.881234132759501
|
||||
],
|
||||
"knee_r": [
|
||||
1.2460291331310924,
|
||||
0.010463648548392655,
|
||||
3.2186438740196976
|
||||
],
|
||||
"hock_r": [
|
||||
1.741964616874774,
|
||||
-0.32966962547812734,
|
||||
2.0198111760469324
|
||||
],
|
||||
"ankle_r": [
|
||||
2.2054374645466424,
|
||||
-0.32966962547812584,
|
||||
0.7118707033215479
|
||||
],
|
||||
"sole.r": [
|
||||
2.2054374645466424,
|
||||
-0.07966962547812584,
|
||||
4.804322302576214e-05
|
||||
],
|
||||
"shoulder_r": [
|
||||
1.1169108483668904,
|
||||
-0.47644512036405606,
|
||||
6.597982901232408
|
||||
],
|
||||
"elbow_r": [
|
||||
0.8707013934956768,
|
||||
-1.1653205176247652,
|
||||
5.558562744531221
|
||||
],
|
||||
"wrist_r": [
|
||||
0.5857000062984679,
|
||||
-1.2223219224540804,
|
||||
4.455898233007579
|
||||
],
|
||||
"brow.r": [
|
||||
1.2196801776857147,
|
||||
0.8713095110712645,
|
||||
7.239312950515832
|
||||
],
|
||||
"n37.r": [
|
||||
1.3290923162374002,
|
||||
0.6180724996875371,
|
||||
6.789312950512516
|
||||
],
|
||||
"battery.r": [
|
||||
0.40973239333496764,
|
||||
-1.5881181838720395,
|
||||
7.559312950470802
|
||||
],
|
||||
"hip_l": [
|
||||
-0.5652709359605912,
|
||||
0.0,
|
||||
4.881234132759501
|
||||
],
|
||||
"knee_l": [
|
||||
-0.6303287185150872,
|
||||
0.823121533593176,
|
||||
3.285619515981198
|
||||
],
|
||||
"hock_l": [
|
||||
-0.6778981440527727,
|
||||
0.25865412000784604,
|
||||
2.069907307183803
|
||||
],
|
||||
"ankle_l": [
|
||||
-0.6533590132531922,
|
||||
0.5424133192120703,
|
||||
0.7118226600985222
|
||||
],
|
||||
"sole.l": [
|
||||
-0.6533590132531922,
|
||||
0.7924133192120703,
|
||||
1.1102230246251565e-16
|
||||
],
|
||||
"shoulder_l": [
|
||||
-1.116910848381801,
|
||||
0.4764451203291017,
|
||||
6.597982901232408
|
||||
],
|
||||
"elbow_l": [
|
||||
-1.2507119338292612,
|
||||
0.857789004875851,
|
||||
5.392895028076397
|
||||
],
|
||||
"wrist_l": [
|
||||
-0.9323417696327686,
|
||||
1.761671142386309,
|
||||
4.7748485121331825
|
||||
],
|
||||
"brow.l": [
|
||||
-0.2152217592846215,
|
||||
1.4834013597988696,
|
||||
7.239312950515832
|
||||
],
|
||||
"n37.l": [
|
||||
-0.47373319431507327,
|
||||
1.387110976294015,
|
||||
6.789312950512516
|
||||
],
|
||||
"battery.l": [
|
||||
-1.4298854745757197,
|
||||
-0.8033850444776743,
|
||||
7.559312950470802
|
||||
]
|
||||
},
|
||||
"torso": {
|
||||
"R": [
|
||||
[
|
||||
0.9198089339553437,
|
||||
0.39236656969718264,
|
||||
-6.8480885159716485e-12
|
||||
],
|
||||
[
|
||||
-0.39236656969718264,
|
||||
0.9198089339553437,
|
||||
-1.6053694386779817e-11
|
||||
],
|
||||
[
|
||||
0.0,
|
||||
1.7453292519943298e-11,
|
||||
1.0
|
||||
]
|
||||
],
|
||||
"waist": [
|
||||
0.0,
|
||||
0.0,
|
||||
5.5093129504934915
|
||||
]
|
||||
},
|
||||
"scan": {
|
||||
"35": 22.84084690963041,
|
||||
"42": 21.8256736835935,
|
||||
"55": 20.31650470496493,
|
||||
"70": 19.015760509577945
|
||||
}
|
||||
}
|
||||
},
|
||||
"inset": {
|
||||
"C": [
|
||||
|
|
|
|||
|
|
@ -1,11 +1,11 @@
|
|||
"""STAG's cameras but the hero's (images/37.webp). Plain Python and numpy; brokkr_reference.core solves and projects.
|
||||
|
||||
The rear and side elevations are solved square from the joints (about 1 px). The rear three-quarter is solved on
|
||||
the joints and the batteries' cell faces (pass 3: re-marked on the faces, follow-up stag-rear3q-batteries). The hero
|
||||
camera is stag_hero.py's, solved together with the body's pose; this script leaves it as it stands. The inset is
|
||||
solved from the built housings once a build has written them.
|
||||
The rear and side elevations are solved square from the joints (about 1 px). The hero and rear three-quarter cameras
|
||||
are stag_hero.py's, each solved together with the body's pose (pass 4 moved the rear three-quarter there: the stance
|
||||
build could not pose its turned torso, follow-up stag-rear3q-torso-turn); this script leaves them as they stand. The
|
||||
inset is solved from the built housings once a build has written them.
|
||||
|
||||
python stag_cameras.py solves rear, side, rear3q and inset, writes them into stag_cameras.json
|
||||
python stag_cameras.py solves rear, side and inset, writes them into stag_cameras.json
|
||||
|
||||
World points: stag_form.J (the skeleton, from the rear and side elevations) and the built points stag.py writes
|
||||
(MECH_OUT/stag/stag_points.json: brow.*, sole.*, battery.*, <side>.<kind>); before a build, stag_form's design
|
||||
|
|
@ -31,9 +31,8 @@ spec.loader.exec_module(core)
|
|||
C = json.loads((HERE / "concepts.json").read_text(encoding="utf-8"))["stag"]
|
||||
VIEWS = C["skeleton"]["views"]
|
||||
MARKS = C["marks"]
|
||||
MODELS = {"rear": "square", "side": "square", "rear3q": "rolled"}
|
||||
# The rear three-quarter's lens is held at what its joints alone solve to (pass 1: 51 mm).
|
||||
LENS = {"rear3q": 51.0}
|
||||
MODELS = {"rear": "square", "side": "square"}
|
||||
LENS = {}
|
||||
OUT = Path(os.environ["MECH_OUT"]) / "stag" if os.environ.get("MECH_OUT") else None
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -36,7 +36,8 @@ HEIGHT = SK["height"]
|
|||
LEG = {"pin_r": 0.11, "links": [(0.42, 0.5), (0.36, 0.42), (0.32, 0.38)], "yoke": (0.42, 0.62, 0.66),
|
||||
"limits": [("hip_pitch", 70.0, 45.0), ("knee_pitch", 60.0, 50.0), ("hock_pitch", 50.0, 60.0)],
|
||||
"foot": dict(width=1.25, length=1.85, drop=0.0, pin_r=0.11)}
|
||||
LEG["foot"]["drop"] = J["ankle_r"][2]
|
||||
ANKLE_CROSS = (0.12, 0.42) # pass 4: the ankle's cross (pitch pin above, roll pin under it): drop, width
|
||||
LEG["foot"]["drop"] = J["ankle_r"][2] - ANKLE_CROSS[0]
|
||||
|
||||
# the torso, in its frame (the waist pin): a narrow waist under a broad chest
|
||||
TORSO = {
|
||||
|
|
@ -60,8 +61,7 @@ TORSO = {
|
|||
# the brow, its cap, the keel and the chin as flat facets meeting at chamfers (the "curved shells" of the prompt are
|
||||
# faceted at figure scale: the 37 shells' outer shoulders turn in two chamfers, not a roll), so each is a hard solid
|
||||
# written by its bounding faces (massing.corners, Bastion pass 2's method), detail plates stepped on its large facets.
|
||||
# Soft cages stay where the concept truly curves: the flanks wrapping the ribs into the waist, the dorsal cover, the
|
||||
# thigh shields, the upper arms' shells.
|
||||
# Soft cages stay where the concept truly curves: the flanks wrapping the ribs into the waist, the dorsal cover.
|
||||
KINDS = {
|
||||
"Breast": "hard", # the 37 shells: front face, its top and bottom chamfers, outer side and two shoulder chamfers, crown, inner cheek
|
||||
"Brow": "hard", # the head's wide faceted wedge, its lip overhanging the recessed visor
|
||||
|
|
@ -70,10 +70,8 @@ KINDS = {
|
|||
"Keel": "hard", # the sternum's pentagon, pointing down between the shells, its centre ridge proud
|
||||
"Flank": "soft", # the lower chest under each breast shell: curved ribs into the waist
|
||||
"Dorsal.cover": "soft", # the equipment module's rear cover: a shallow curve
|
||||
"Shield": "soft", # the thigh shields: ovoid, one crease down the outer front
|
||||
"Plate": "hard", # shin, metatarsus and forearm plates: a ridge and flat faces
|
||||
"Shell": "soft", # the upper arms' shells
|
||||
}
|
||||
# the limbs' plates, every one hard: stag_limbs.KINDS (pass 4)
|
||||
|
||||
# The hard hull, in the torso's frame, the right side (x >= 0; mirrored). A plate is {"faces": [(point, outward
|
||||
# normal)]} (its corners are where three faces meet inside the rest) or {"points": [...], "mirror": True} (one solid
|
||||
|
|
@ -81,11 +79,17 @@ KINDS = {
|
|||
# hand (about 0.05 m); depths where only one view shows a face are planes of my choosing.
|
||||
HULL = {
|
||||
# the 37 shell: a broad front face turned a little outboard, its top edge chamfered back to the crown, the outer
|
||||
# shoulder rounded by two chamfers into the outer side, the underside cut up in a V toward the waist
|
||||
"Breast": {"faces": [((0.95, 1.1, 1.25), (0.34, 1.0, 0.04)), ((0.95, 0.0, 1.76), (0.0, 0.0, 1.0)), ((0.95, 0.98, 1.64), (0.0, 0.75, 0.66)),
|
||||
((1.58, 0.0, 1.25), (1.0, 0.0, 0.06)), ((1.48, 0.9, 1.25), (0.78, 0.62, 0.0)), ((1.54, 0.0, 1.62), (0.62, 0.0, 0.78)),
|
||||
((1.4, 0.0, 1.72), (0.28, 0.0, 0.96)), ((0.52, 0.0, 1.25), (-1.0, 0.08, -0.3)), ((0.95, 0.0, 0.78), (0.0, 0.0, -1.0)),
|
||||
((1.42, 0.0, 0.92), (0.62, 0.0, -0.78)), ((0.95, 1.0, 0.86), (0.0, 0.62, -0.78)), ((0.95, -0.56, 1.25), (0.0, -1.0, 0.0))],
|
||||
# shoulder rounded by two chamfers into the outer side, the underside cut up in a V toward the waist. Pass 4: the
|
||||
# hero draws each shell wider than pass 3 built it (1.06 m, a box beside the head) and turned further outboard,
|
||||
# its front face about 30 degrees round (pass 3: 19), its underside cut up in a V both ways. The outer side stays
|
||||
# (the elevations' 2.8 m across); the shell grows inward to the head's cheek (1.22 m across), forward 0.1 m, its
|
||||
# crown 0.04 m (the arrays' roots stand on it, pass 3's, kept). A first cut also took it 0.28 m lower: the hero at
|
||||
# its posed camera drew it a third taller than the sheet, and it went back.
|
||||
"Breast": {"faces": [((0.95, 1.2, 1.25), (0.58, 1.0, 0.04)), ((0.95, 0.0, 1.8), (0.0, 0.0, 1.0)), ((0.95, 1.08, 1.7), (0.0, 0.75, 0.66)),
|
||||
((1.58, 0.0, 1.25), (1.0, 0.0, 0.06)), ((1.5, 0.85, 1.25), (0.9, 0.44, 0.0)), ((1.55, 0.0, 1.68), (0.62, 0.0, 0.78)),
|
||||
((1.4, 0.0, 1.77), (0.28, 0.0, 0.96)), ((0.36, 0.0, 1.25), (-1.0, 0.08, -0.3)), ((0.95, 0.0, 0.76), (0.0, 0.0, -1.0)),
|
||||
((1.42, 0.0, 0.98), (0.7, 0.0, -0.72)), ((0.95, 1.1, 0.88), (0.0, 0.62, -0.78)), ((0.5, 1.0, 0.9), (-0.45, 0.4, -0.8)),
|
||||
((0.95, -0.56, 1.25), (0.0, -1.0, 0.0))],
|
||||
"bevel": 0.035, "clad": True},
|
||||
# the head: a wide flattened wedge, its lip a front face 0.22 m deep forward over the visor (the hero's camera is
|
||||
# under the head: a lip that is only an edge reads as a dark underside), the crown ridged, its back low over the
|
||||
|
|
@ -102,13 +106,14 @@ HULL = {
|
|||
(0.0, 1.06, 1.18), (0.32, 0.96, 1.18), (0.0, 0.7, 1.42), (0.44, 0.7, 1.42), (0.0, 0.7, 1.18), (0.34, 0.7, 1.18)],
|
||||
"mirror": True, "bevel": 0.025, "clad": False},
|
||||
# the sternum: a pentagon pointing down between the shells, under the cockpit's dark recess, its centre ridge proud
|
||||
"Keel": {"points": [(0.0, 1.2, 1.1), (0.32, 1.12, 1.1), (0.34, 1.06, 0.84), (0.0, 0.94, 0.42), (0.14, 0.93, 0.54),
|
||||
(0.0, 1.26, 0.86), (0.0, 0.75, 1.1), (0.34, 0.75, 1.1), (0.34, 0.75, 0.84), (0.0, 0.7, 0.42)],
|
||||
# (pass 4: 0.92 m across and down to 0.3, the hero's big centre plate; pass 3 built it 0.68 across)
|
||||
"Keel": {"points": [(0.0, 1.24, 1.14), (0.44, 1.14, 1.14), (0.46, 1.08, 0.84), (0.0, 0.94, 0.3), (0.18, 0.93, 0.44),
|
||||
(0.0, 1.3, 0.86), (0.0, 0.75, 1.14), (0.46, 0.75, 1.14), (0.46, 0.75, 0.84), (0.0, 0.7, 0.3)],
|
||||
"mirror": True, "bevel": 0.03, "clad": True},
|
||||
"Keel.ridge": {"points": [(0.0, 1.29, 1.05), (0.08, 1.26, 1.05), (0.0, 1.31, 0.86), (0.07, 1.28, 0.86), (0.0, 1.03, 0.5),
|
||||
(0.0, 1.12, 1.05), (0.08, 1.12, 1.05), (0.0, 0.95, 0.5)], "mirror": True, "bevel": 0.015, "clad": False},
|
||||
"Keel.ridge": {"points": [(0.0, 1.33, 1.08), (0.09, 1.3, 1.08), (0.0, 1.35, 0.86), (0.08, 1.32, 0.86), (0.0, 1.03, 0.38),
|
||||
(0.0, 1.14, 1.08), (0.09, 1.14, 1.08), (0.0, 0.95, 0.38)], "mirror": True, "bevel": 0.015, "clad": False},
|
||||
}
|
||||
NUMERAL = {"at": (0.98, 1.1, 1.28), "height": 0.34} # the 37 on each breast's front face, centred (the hero: x 215 and 350)
|
||||
NUMERAL = {"at": (0.95, 1.2, 1.2), "height": 0.4} # the 37 on each breast's front face, centred (the hero: x 215 and 350)
|
||||
|
||||
# The sensor arrays, pass 3: measured off the hero through its posed camera (stag_hero.py arrays; stag_arrays.json:
|
||||
# the two sides averaged, on the frontal plane through the roots, from each side's marked root). Pass 2's arrays were
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
"""STAG's hero camera, solved together with the body's pose (pass 3; follow-up stag-hero-pose-solve). Plain Python and
|
||||
numpy; no Blender.
|
||||
"""STAG's posed cameras: the hero's and, from pass 4, the rear three-quarter's (follow-up stag-rear3q-torso-turn), each
|
||||
solved together with the body's pose (pass 3; follow-up stag-hero-pose-solve). Plain Python and numpy; no Blender.
|
||||
|
||||
Pass 2 solved the hero camera on the elevations' stance and missed by 24 to 28 px rms, every leg joint pulled the
|
||||
same way: the hero does not stand as the elevations do. Its right leg strides out and forward, the torso turns on
|
||||
|
|
@ -12,15 +12,19 @@ scanned and the marked horizon chooses) and the pose, about the elevations' stan
|
|||
it runs to either bound, 20 degrees back or 12 forward at 1 px apart, and the arrays measured off it
|
||||
move 0.6 m with it; the marks do not decide it)
|
||||
pelvis a drop (the stance's legs straightened or bent under it)
|
||||
legs a side: hip abduction (about the front axis), hip flexion, knee and hock bends (about the pin axes)
|
||||
legs a side: hip abduction (about the front axis), hip flexion and the knee bend (about the pin axes); the
|
||||
hock's bend is not free: it is solved in closed form so the ankle stands at the stance's height (pass 4).
|
||||
Pass 3 held the soles to the ground by a 60 px a metre penalty, and the marks pulled the right ankle 0.17 m
|
||||
up: the hero's right foot floated 0.2 m over the ground. Contact is now a hard constraint of the pose.
|
||||
arms a side: shoulder flexion and abduction, elbow bend
|
||||
fitted to the hero's 19 marks (15 joints, the brow's lip corners, the soles) and the horizon by brokkr_reference's
|
||||
Levenberg-Marquardt, with the soles held to the ground and weak priors (0.4 px a degree) holding each angle near
|
||||
the stance where the marks do not move it.
|
||||
fitted to a view's marks (the hero's 19: 15 joints, the brow's lip corners, the soles, the 37s, and its horizon; the
|
||||
rear three-quarter's 14 joints and its two batteries' cell faces) by brokkr_reference's Levenberg-Marquardt, with
|
||||
weak priors (0.4 px a degree) holding each angle near the stance where the marks do not move it.
|
||||
|
||||
python stag_hero.py arrays the arrays measured off the hero through the solved camera and pose (arrays())
|
||||
python stag_hero.py prints the lens scan, writes the hero camera into stag_cameras.json with "solved": the
|
||||
pose, the posed joints ("joints", world), the torso's frame, residuals
|
||||
python stag_hero.py [view] view hero (default) or rear3q: prints the lens scan, writes that camera into
|
||||
stag_cameras.json with "solved": the pose, the posed joints ("joints", world), the
|
||||
torso's frame, residuals. stag_cameras.py no longer solves the rear three-quarter.
|
||||
"""
|
||||
import importlib.util
|
||||
import json
|
||||
|
|
@ -42,19 +46,53 @@ sys.modules["reference_core"] = RC
|
|||
_spec.loader.exec_module(RC)
|
||||
|
||||
C = json.loads((HERE / "concepts.json").read_text(encoding="utf-8"))["stag"]
|
||||
HERO = C["skeleton"]["views"]["hero"]
|
||||
BOX = HERO["box"]
|
||||
MARKS = dict(HERO["joints"])
|
||||
MARKS.update({k: v for k, v in C["marks"]["hero"].items() if not k.startswith("_")})
|
||||
HZ = C["marks"]["hero_horizon"]
|
||||
NAMES = list(MARKS)
|
||||
J0 = {k: np.asarray(v, float) for k, v in SF.J.items()}
|
||||
D0 = {k: np.asarray(v, float) for k, v in SF.design_points().items()}
|
||||
WAIST = J0["waist"]
|
||||
POSE = ("torso_yaw", "torso_pitch", "drop",
|
||||
"hip_abd_r", "hip_flex_r", "knee_r", "hock_r", "hip_abd_l", "hip_flex_l", "knee_l", "hock_l",
|
||||
"hip_abd_r", "hip_flex_r", "knee_r", "hip_abd_l", "hip_flex_l", "knee_l",
|
||||
"sh_flex_r", "sh_abd_r", "elbow_r", "sh_flex_l", "sh_abd_l", "elbow_l")
|
||||
ANGLES = [k for k in POSE if k != "drop"]
|
||||
BATTERY = (1.0, -1.3, 2.05) # each battery's cell face, the torso's frame (stag_form.design_points; stag_body.batteries builds it there)
|
||||
|
||||
|
||||
class View:
|
||||
"""A view's marks, frame and holds: the hero's or the rear three-quarter's."""
|
||||
|
||||
def __init__(self, tag):
|
||||
v = C["skeleton"]["views"][tag]
|
||||
self.tag, self.box = tag, v["box"]
|
||||
self.marks = dict(v["joints"])
|
||||
self.marks.update({k: m for k, m in C["marks"].get(tag, {}).items() if not k.startswith("_")})
|
||||
self.names = list(self.marks)
|
||||
self.horizon = C["marks"].get(f"{tag}_horizon")
|
||||
|
||||
|
||||
VIEW = View("hero")
|
||||
BOX, MARKS, NAMES, HZ = VIEW.box, VIEW.marks, VIEW.names, VIEW.horizon
|
||||
|
||||
|
||||
def use(tag):
|
||||
"""Point the solve at a view."""
|
||||
global VIEW, BOX, MARKS, NAMES, HZ
|
||||
VIEW = View(tag)
|
||||
BOX, MARKS, NAMES, HZ = VIEW.box, VIEW.marks, VIEW.names, VIEW.horizon
|
||||
|
||||
|
||||
def hock_for(hip, Rl, knee, hock2, ankle_k, target_z):
|
||||
"""The hock bend (radians) that sets the ankle at target_z: ankle = hip + Rl (hock2 + Rx(t) (ankle_k - hock2));
|
||||
its height is A cos t + B sin t + const, solved in closed form, the root nearest the stance's (0). Where no bend
|
||||
reaches, the nearest one."""
|
||||
v = ankle_k - hock2
|
||||
r = Rl[2]
|
||||
A, B = r[1] * v[1] + r[2] * v[2], r[2] * v[1] - r[1] * v[2]
|
||||
D = target_z - hip[2] - r @ hock2 - r[0] * v[0]
|
||||
R = math.hypot(A, B)
|
||||
phi = math.atan2(B, A)
|
||||
c = max(-1.0, min(1.0, D / R)) if R > 1e-9 else 1.0
|
||||
roots = [phi + math.acos(c), phi - math.acos(c)]
|
||||
roots = [(t + math.pi) % (2 * math.pi) - math.pi for t in roots]
|
||||
return min(roots, key=abs)
|
||||
|
||||
|
||||
def rx(t):
|
||||
|
|
@ -91,10 +129,11 @@ def posed(q):
|
|||
knee, hock, ankle = (J0[f"{n}_{tag}"] - J0[f"hip_{tag}"] for n in ("knee", "hock", "ankle"))
|
||||
Rk = rx(p[f"knee_{tag}"])
|
||||
hock2 = knee + Rk @ (hock - knee)
|
||||
ankle2 = knee + Rk @ (ankle - knee)
|
||||
Rh = rx(p[f"hock_{tag}"])
|
||||
ankle2 = hock2 + Rh @ (ankle2 - hock2)
|
||||
ankle_k = knee + Rk @ (ankle - knee)
|
||||
Rl = ry(-s * p[f"hip_abd_{tag}"]) @ rx(p[f"hip_flex_{tag}"])
|
||||
h = hock_for(hip, Rl, knee, hock2, ankle_k, J0[f"ankle_{tag}"][2])
|
||||
W[f"_hock_{tag}"] = np.array([math.degrees(h), 0.0, 0.0])
|
||||
ankle2 = hock2 + rx(h) @ (ankle_k - hock2)
|
||||
W[f"hip_{tag}"] = hip
|
||||
W[f"knee_{tag}"], W[f"hock_{tag}"], W[f"ankle_{tag}"] = (hip + Rl @ v for v in (knee, hock2, ankle2))
|
||||
a = W[f"ankle_{tag}"]
|
||||
|
|
@ -108,6 +147,7 @@ def posed(q):
|
|||
W[f"elbow_{tag}"], W[f"wrist_{tag}"] = (w + Rt @ (sh + Ra @ v) for v in (el, wr))
|
||||
W[f"brow.{tag}"] = w + Rt @ (D0[f"brow.{tag}"] - WAIST)
|
||||
W[f"n37.{tag}"] = w + Rt @ np.array([s * NUMERAL[0], NUMERAL[1], NUMERAL[2]])
|
||||
W[f"battery.{tag}"] = w + Rt @ (np.array([s * BATTERY[0], BATTERY[1], WAIST[2] + BATTERY[2]]) - WAIST)
|
||||
return W, Rt, w
|
||||
|
||||
|
||||
|
|
@ -124,11 +164,12 @@ def horizon_v(cam):
|
|||
return float(RC.project(cam, [np.asarray(cam["C"], float) + 1e7 * flat])[0][1])
|
||||
|
||||
|
||||
NUMERAL = (0.98, 1.09, 1.28) # the 37 on each breast shell's front face, the torso's frame (stag_form.NUMERAL on HULL["Breast"]'s front)
|
||||
NUMERAL = (0.95, 1.19, 1.2) # the 37 on each breast shell's front face, the torso's frame (stag_form.NUMERAL on HULL["Breast"]'s front)
|
||||
PRIOR = 0.4 # px a degree: how hard an angle the marks do not move is held at the stance
|
||||
NC = 7
|
||||
LEVEL = 3.0 # px a degree: the hero's verticals (the mast at u 65, the treeline at u 715) stand vertical, so the camera is held level and
|
||||
# unrolled, and the low horizon is a shifted frame (the principal point's v), not a camera pitched up
|
||||
GROUND = 3000.0 # px a metre: where no hock bend sets an ankle on the ground, the pose that cannot reach is pushed out hard (main() asserts contact)
|
||||
BALANCE = 25.0 # px a metre: the waist over the middle of the two ankles, front to back
|
||||
|
||||
|
||||
|
|
@ -137,69 +178,83 @@ def residual(x, lens):
|
|||
W, _, _ = posed(x[NC:])
|
||||
r = (RC.project(cam, [W[k] for k in NAMES]) - np.array([MARKS[k] for k in NAMES])).ravel()
|
||||
p = dict(zip(POSE, x[NC:]))
|
||||
ground = [60.0 * (W[f"ankle_{t}"][2] - J0[f"ankle_{t}"][2]) for t in ("r", "l")] # 60 px a metre: the soles stay on the ground
|
||||
ground = [GROUND * (W[f"ankle_{t}"][2] - J0[f"ankle_{t}"][2]) for t in ("r", "l")] # zero wherever a hock bend reaches (hock_for); else the miss, steeply
|
||||
prior = [PRIOR * p[k] for k in ANGLES]
|
||||
level = [LEVEL * math.degrees(x[2]), LEVEL * x[4], BALANCE * (W["waist"][1] - 0.5 * (W["ankle_r"][1] + W["ankle_l"][1]) - (WAIST[1] - J0["ankle_r"][1]))]
|
||||
return np.concatenate([r, [0.5 * (horizon_v(cam) - HZ)], ground, prior, level])
|
||||
horizon = [0.5 * (horizon_v(cam) - HZ)] if HZ is not None else []
|
||||
return np.concatenate([r, horizon, ground, prior, level])
|
||||
|
||||
|
||||
LO = [-80, 3, -0.8, 0.3, -15, -80, -100] + [-60, -1e-9, -0.5] + [-15, -40, -40, -40] * 2 + [-60, -30, -60] * 2
|
||||
HI = [80, 60, 0.8, 8.0, 15, 80, 400] + [60, 1e-9, 1.0] + [35, 40, 40, 40] * 2 + [80, 50, 80] * 2
|
||||
LO = [-180, 3, -0.8, 0.3, -15, -80, -100] + [-60, -1e-9, -0.5] + [-15, -40, -40] * 2 + [-60, -30, -60] * 2
|
||||
HI = [180, 60, 0.8, 8.0, 15, 80, 400] + [60, 1e-9, 1.0] + [35, 40, 60] * 2 + [80, 50, 80] * 2
|
||||
|
||||
|
||||
# The camera's azimuth about the pelvis is not decided by the marks: held anywhere from -12 to -40 degrees the solve
|
||||
# moves under a pixel (15.8 to 16.8 px at 55 mm), the legs' pose and the waist's turn taking it up, and the torso is
|
||||
# seen 6 to 7 degrees off frontal throughout. Held at -25: the legs then stand three-quarter on, as the hero's feet and
|
||||
# thighs draw them (the near foot large and outboard), for 0.4 px over the least.
|
||||
AZIMUTH = -25.0
|
||||
# The hero camera's azimuth about the pelvis is not decided by the marks: held anywhere from -12 to -40 degrees the
|
||||
# solve moves under a pixel, the legs' pose and the waist's turn taking it up. Held at -25: the legs then stand
|
||||
# three-quarter on, as the hero's feet and thighs draw them (the near foot large and outboard). The rear
|
||||
# three-quarter's likewise: its marks fix the torso's facing, seen 165 to 168 degrees round from its front, and leave
|
||||
# the legs' azimuth free (held at 135, 145, 155 and 165 degrees the solve reads 20.7, 20.0, 19.6 and 19.4 px at 55 mm,
|
||||
# the waist's turn taking up the difference: -30, -21, -12, -3 degrees). Held at 140: the legs stand three-quarter on,
|
||||
# the near (left) thigh's outer face and both feet side-on as the view draws them, the torso turned on the waist
|
||||
# to show its back square, the batteries both in view.
|
||||
AZIMUTH = {"hero": [-25.0], "rear3q": [140.0]}
|
||||
HOLD = {"hero": True, "rear3q": True}
|
||||
|
||||
|
||||
def solve(lens, azimuth=AZIMUTH):
|
||||
def solve(lens):
|
||||
best = None
|
||||
lo, hi = list(LO), list(HI)
|
||||
lo[0], hi[0] = azimuth, azimuth + 1e-9
|
||||
for yaw in (-30, -10, 10):
|
||||
for tp in (-5, 8):
|
||||
x0 = [azimuth, 14 * lens / 35, 0.0, 1.5, 0, 0, 250] + [yaw, 0 * tp, 0] + [0] * 8 + [0] * 6
|
||||
x, _ = RC.lm(lambda v: residual(v, lens), x0, lo, hi, rounds=500)
|
||||
r = residual(x, lens)[:2 * len(NAMES)].reshape(-1, 2)
|
||||
rms = float(np.sqrt((r ** 2).sum(1).mean()))
|
||||
if best is None or rms < best[0]:
|
||||
best = (rms, x, r)
|
||||
for azimuth in AZIMUTH[VIEW.tag]:
|
||||
lo, hi = list(LO), list(HI)
|
||||
if HOLD[VIEW.tag]:
|
||||
lo[0], hi[0] = azimuth, azimuth + 1e-9
|
||||
else:
|
||||
lo[0], hi[0] = 90.0, 180.0
|
||||
for yaw in (-30, -10, 10):
|
||||
for tp in (-5, 8):
|
||||
x0 = [azimuth, 14 * lens / 35, 0.0, 1.5, 0, 0, 250 if VIEW.tag == "hero" else 0] + [yaw, 0 * tp, 0] + [0] * 6 + [0] * 6
|
||||
x, _ = RC.lm(lambda v: residual(v, lens), x0, lo, hi, rounds=500)
|
||||
r = residual(x, lens)[:2 * len(NAMES)].reshape(-1, 2)
|
||||
rms = float(np.sqrt((r ** 2).sum(1).mean()))
|
||||
if best is None or rms < best[0]:
|
||||
best = (rms, x, r)
|
||||
return best
|
||||
|
||||
|
||||
def describe(rms, x, lens):
|
||||
cam = cam_of(x[:NC], lens)
|
||||
p = dict(zip(POSE, x[NC:]))
|
||||
return (f"lens {lens}: rms {rms:.1f} px; azimuth {x[0]:.1f}, {x[1]:.1f} m off, pitch {math.degrees(x[2]):.1f}, eye {x[3]:.2f} m, roll {x[4]:.1f}, "
|
||||
f"centre v {cam['c'][1]:.0f}, horizon v {horizon_v(cam):.0f} (marked {HZ}); " + ", ".join(f"{k} {v:.1f}" for k, v in p.items()))
|
||||
W, _, _ = posed(x[NC:])
|
||||
hz = f"horizon v {horizon_v(cam):.0f} (marked {HZ}); " if HZ is not None else ""
|
||||
return (f"{VIEW.tag} lens {lens}: rms {rms:.1f} px; azimuth {x[0]:.1f}, {x[1]:.1f} m off, pitch {math.degrees(x[2]):.1f}, eye {x[3]:.2f} m, roll {x[4]:.1f}, "
|
||||
f"centre v {cam['c'][1]:.0f}, {hz}" + ", ".join(f"{k} {v:.1f}" for k, v in p.items())
|
||||
+ f", hock_r {W['_hock_r'][0]:.1f}, hock_l {W['_hock_l'][0]:.1f}; ankles z {W['ankle_r'][2]:.3f} {W['ankle_l'][2]:.3f}")
|
||||
|
||||
|
||||
def main():
|
||||
def main(tag="hero"):
|
||||
use(tag)
|
||||
scan = {}
|
||||
for lens in (35, 42, 55, 70):
|
||||
rms, x, r = solve(lens)
|
||||
scan[lens] = (rms, x, r)
|
||||
print(describe(rms, x, lens), flush=True)
|
||||
stance = RC.lm(lambda v: residual(np.concatenate([v, np.zeros(len(POSE))]), 35)[: 2 * len(NAMES) + 1], [-15, 14, 0.0, 1.5, 0, 0, 250], LO[:NC], HI[:NC], rounds=400)[0]
|
||||
rs = residual(np.concatenate([stance, np.zeros(len(POSE))]), 35)[:2 * len(NAMES)].reshape(-1, 2)
|
||||
print(f"the stance unposed, lens 35: rms {float(np.sqrt((rs ** 2).sum(1).mean())):.1f} px", flush=True)
|
||||
best = min(v[0] for v in scan.values())
|
||||
lens = min(k for k in scan if scan[k][0] <= best + 1.0) # the shortest lens within 1 px of the best: past it a longer lens buys under a pixel
|
||||
rms, x, r = scan[lens]
|
||||
cam = cam_of(x[:NC], lens)
|
||||
W, Rt, w = posed(x[NC:])
|
||||
cam.update(azimuth=float(x[0]), distance=float(x[1]), lens=float(lens), unit=1024, rms=rms, elevation=math.degrees(x[2]), roll=float(x[4]), horizon=horizon_v(cam),
|
||||
model="posed", marks=NAMES, residuals={n: [float(a), float(b)] for n, (a, b) in zip(NAMES, r)},
|
||||
solved={"pose": {k: float(v) for k, v in zip(POSE, x[NC:])}, "joints": {k: [float(c) for c in v] for k, v in W.items()},
|
||||
"torso": {"R": Rt.tolist(), "waist": [float(c) for c in w]}, "stance_rms": float(np.sqrt((rs ** 2).sum(1).mean())),
|
||||
"scan": {str(k): v[0] for k, v in scan.items()}})
|
||||
pose = {k: float(v) for k, v in zip(POSE, x[NC:])}
|
||||
pose.update(hock_r=float(W.pop("_hock_r")[0]), hock_l=float(W.pop("_hock_l")[0]))
|
||||
miss = {t: float(W[f"ankle_{t}"][2] - J0[f"ankle_{t}"][2]) for t in ("r", "l")}
|
||||
assert all(abs(v) < 0.005 for v in miss.values()), f"the soles leave the ground: {miss}"
|
||||
cam.update(azimuth=float(x[0]), distance=float(x[1]), lens=float(lens), unit=1024, rms=rms, elevation=math.degrees(x[2]), roll=float(x[4]),
|
||||
horizon=horizon_v(cam) if HZ is not None else None, model="posed", marks=NAMES, residuals={n: [float(a), float(b)] for n, (a, b) in zip(NAMES, r)},
|
||||
solved={"pose": pose, "joints": {k: [float(c) for c in v] for k, v in W.items()},
|
||||
"torso": {"R": Rt.tolist(), "waist": [float(c) for c in w]}, "scan": {str(k): v[0] for k, v in scan.items()}})
|
||||
path = HERE / "stag_cameras.json"
|
||||
cams = json.loads(path.read_text(encoding="utf-8"))
|
||||
cams["hero"] = json.loads(json.dumps(cam, default=float))
|
||||
cams[tag] = json.loads(json.dumps(cam, default=float))
|
||||
path.write_text(json.dumps(cams, indent=1), encoding="utf-8")
|
||||
print("HERO-SOLVED", describe(rms, x, lens), flush=True)
|
||||
print("SOLVED", describe(rms, x, lens), flush=True)
|
||||
print("worst", sorted(((n, round(math.hypot(*v))) for n, v in cam["residuals"].items()), key=lambda q: -q[1])[:6])
|
||||
|
||||
|
||||
|
|
@ -254,4 +309,4 @@ def arrays():
|
|||
|
||||
|
||||
if __name__ == "__main__":
|
||||
arrays() if sys.argv[1:] == ["arrays"] else main()
|
||||
arrays() if sys.argv[1:] == ["arrays"] else main(sys.argv[1] if sys.argv[1:] else "hero")
|
||||
|
|
|
|||
124
surfaces/blender/experiments/mechs/stag_limbs.py
Normal file
124
surfaces/blender/experiments/mechs/stag_limbs.py
Normal file
|
|
@ -0,0 +1,124 @@
|
|||
"""STAG's limb armour, pass 4 (images/37.webp): the thighs, shins, metatarsi, upper arms and the left forearm as hard
|
||||
plates authored by their faces (hardplate.py, Paladin pass 3's method), over dark housings, with stepped, bolted
|
||||
panels and fits on top. Pass 3 dressed each link with one octagonal block and a thin cage shell: at figure scale
|
||||
the limbs read as bare tubes. The concept's thighs carry a tall shield with the stag's emblem over a plated
|
||||
housing; its shins a knee guard and a greave; its lower legs a long front plate over exposed rams; its upper arms
|
||||
plated shells. Runs inside Blender.
|
||||
|
||||
Where the numbers come from, said plainly: read by hand off the hero (the right thigh's shield about 75 px wide by
|
||||
150 tall near 85 px a metre at the hips) and the rear three-quarter (the left thigh's shield 80 by 110 px at about
|
||||
72 px a metre), and checked against the hero at its posed camera (stag_sheets: a first cut 1.04 m across the
|
||||
shield drew the thighs a third wider than the sheet; built 0.8), the left elevation for depths. Nothing here is a fit: no plate was moved by a solver.
|
||||
|
||||
Frames: each table is in its link's frame (link_frame): origin on the link's upper pin, z up the link (the lower
|
||||
pin at z = -length), y forward, x the mech's right; the left side is the right's mirror (hardplate.part's sx).
|
||||
Every plate is hard (KINDS): the sheet draws each with a faceted outline. Tables are functions of the link's
|
||||
length, so the hero's and the stance's builds carry the same plates.
|
||||
"""
|
||||
import math
|
||||
|
||||
from mathutils import Matrix, Vector
|
||||
|
||||
import hardplate as HP
|
||||
import mechlib as M
|
||||
from hardplate import CORE, FWD, P, P2, hexa, house, octa, slab
|
||||
|
||||
BOLTS = ("bolts", 0.07, 0.3)
|
||||
|
||||
|
||||
def thigh(L):
|
||||
"""Hero: the shield on the front and outer face, a tall elongated octagon from 0.3 m over the hip pin to just
|
||||
above the knee, the stag's emblem on it; rear three-quarter: the outer and rear plates, stepped. About 0.8 m
|
||||
across the shield (the hero's 75 px near 85 px a metre, turned), 0.95 m deep."""
|
||||
return [
|
||||
("core", house([(0.0, 0.5, -0.3, 0.32, 0.1), (-0.45, 0.7, -0.42, 0.44, 0.14), (-L + 0.5, 0.64, -0.39, 0.41, 0.13), (-L + 0.2, 0.46, -0.29, 0.31, 0.08)])),
|
||||
("Shield", slab((0.08, 0.54, -0.66), (0.32, 1, 0.04), octa(0.8, 1.92, 0.24, 0.2), 0.2, fit=[("mark", 0.0, 0.08), BOLTS])),
|
||||
("ShieldStep", slab((0.1, 0.6, 0.04), (0.32, 1, 0.1), hexa(0.4, 0.26, 0.06), 0.1, mat=P2, clad=False, fit=[("slot", 0.0, 0.0, 0.24, 0.08)])),
|
||||
("Outer", slab((0.39, -0.05, -0.78), (1, 0.05, 0.03), [(-0.42, 0.72), (0.26, 0.76), (0.42, 0.46), (0.42, -0.56), (0.26, -0.82), (-0.38, -0.72), (-0.47, -0.2)], 0.16,
|
||||
right=FWD, fit=[BOLTS])),
|
||||
("OuterStep", slab((0.46, -0.1, -0.66), (1, 0.05, 0.03), hexa(0.44, 0.5, 0.1), 0.09, right=FWD, mat=P2, clad=False,
|
||||
fit=[("port", 0.0, 0.1, 0.09), ("vents", 0.0, -0.14, 0.26, 0.03, 2)])),
|
||||
("Inner", slab((-0.36, 0.0, -0.92), (-1, 0.05, 0), hexa(0.64, 1.1, 0.14), 0.12, right=FWD, mat=P2, fit=[BOLTS])),
|
||||
("Rear", slab((0.0, -0.44, -0.82), (0, -1, 0.05), hexa(0.54, 1.2, 0.14), 0.16, fit=[BOLTS, ("handle", 0.0, 0.42, 0.26)])),
|
||||
("RearStep", slab((0.0, -0.5, -1.12), (0, -1, 0.05), hexa(0.4, 0.32, 0.07), 0.09, mat=P2, clad=False, fit=[("vents", 0.0, 0.0, 0.26, 0.03, 3)])),
|
||||
("Lame", slab((0.05, 0.45, -1.72), (0.2, 1, -0.2), [(-0.3, 0.13), (0.3, 0.13), (0.35, 0.0), (0.24, -0.15), (-0.24, -0.15), (-0.35, 0.0)], 0.11, mat=P2, clad=False)),
|
||||
]
|
||||
|
||||
|
||||
def shin(L):
|
||||
"""Hero: the knee guard, a stepped block over the knee's front, and the greave down the shin; the side plates
|
||||
either side of the knee's drums; rear three-quarter: the calf plate. About 0.55 m across."""
|
||||
return [
|
||||
("core", house([(-0.22, 0.46, -0.29, 0.32, 0.1), (-0.55, 0.54, -0.34, 0.37, 0.12), (-L + 0.35, 0.48, -0.29, 0.32, 0.1), (-L + 0.14, 0.36, -0.22, 0.24, 0.07)])),
|
||||
("Knee", slab((0.0, 0.44, 0.06), (0, 1, 0.35), hexa(0.58, 0.56, 0.12), 0.22, fit=[BOLTS, ("step", hexa(0.38, 0.24, 0.07), 0.0, 0.02, 0.045)])),
|
||||
("Greave", slab((0.0, 0.4, -0.74), (0, 1, 0.0), octa(0.52, 0.9, 0.11, 0.14), 0.18, fit=[("mark2", 0.0, 0.12), BOLTS])),
|
||||
("GreaveStep", slab((0.0, 0.46, -1.05), (0, 1, 0.0), hexa(0.32, 0.2, 0.05), 0.07, mat=P2, clad=False, fit=[("slot", 0.0, 0.0, 0.2, 0.07)])),
|
||||
("Outer", slab((0.3, 0.02, -0.56), (1, 0.05, 0.0), [(-0.32, 0.44), (0.26, 0.48), (0.37, 0.2), (0.33, -0.4), (-0.26, -0.44), (-0.37, 0.0)], 0.14, right=FWD,
|
||||
fit=[BOLTS, ("port", 0.0, 0.05, 0.08)])),
|
||||
("Inner", slab((-0.28, 0.04, -0.62), (-1, 0.05, 0.0), hexa(0.52, 0.66, 0.11), 0.1, right=FWD, mat=P2)),
|
||||
("Calf", slab((0.0, -0.36, -0.58), (0, -1, 0.06), hexa(0.44, 0.7, 0.1), 0.14, fit=[("vents", 0.0, 0.0, 0.24, 0.03, 3)])),
|
||||
]
|
||||
|
||||
|
||||
def meta(L):
|
||||
"""Hero: the long lower leg, a tapering front plate stepped over a narrow housing, the rams bare behind it
|
||||
(stag_body.lower_rams); a cap over the hock's back; a plate on the outer face. About 0.45 m across."""
|
||||
return [
|
||||
("core", house([(-0.18, 0.4, -0.25, 0.29, 0.09), (-L + 0.32, 0.36, -0.23, 0.26, 0.07)])),
|
||||
("Front", slab((0.0, 0.33, -0.64), (0, 1, 0.0), [(-0.24, 0.52), (0.24, 0.52), (0.29, 0.28), (0.24, -0.46), (0.13, -0.62), (-0.13, -0.62), (-0.24, -0.46), (-0.29, 0.28)],
|
||||
0.16, fit=[BOLTS, ("handle", 0.0, -0.3, 0.16)])),
|
||||
("FrontStep", slab((0.0, 0.39, -0.38), (0, 1, 0.0), hexa(0.32, 0.26, 0.05), 0.07, mat=P2, clad=False, fit=[("slot", 0.0, 0.0, 0.2, 0.08)])),
|
||||
("Outer", slab((0.24, 0.0, -0.52), (1, 0.05, 0.0), hexa(0.42, 0.6, 0.09), 0.1, right=FWD, mat=P2, fit=[BOLTS])),
|
||||
("HockCap", slab((0.0, -0.27, 0.06), (0, -1, 0.55), hexa(0.4, 0.38, 0.09), 0.16, fit=[BOLTS])),
|
||||
]
|
||||
|
||||
|
||||
def upper_arm(L):
|
||||
"""Hero: the short upper arm under the breast shell, plated on its outer, front and rear faces."""
|
||||
return [
|
||||
("core", house([(-0.12, 0.42, -0.24, 0.24, 0.08), (-L + 0.24, 0.4, -0.22, 0.22, 0.08)])),
|
||||
("Outer", slab((0.27, 0.0, -0.56), (1, 0, 0.03), [(-0.3, 0.42), (0.3, 0.42), (0.36, 0.1), (0.28, -0.44), (-0.28, -0.44), (-0.36, 0.1)], 0.14, right=FWD,
|
||||
fit=[BOLTS, ("port", 0.0, 0.16, 0.08)])),
|
||||
("Front", slab((0.0, 0.27, -0.6), (0, 1, 0.0), hexa(0.42, 0.82, 0.1), 0.12, fit=[BOLTS])),
|
||||
("Rear", slab((0.0, -0.27, -0.6), (0, -1, 0.0), hexa(0.4, 0.72, 0.1), 0.1, mat=P2, fit=[("vents", 0.0, 0.0, 0.24, 0.03, 3)])),
|
||||
]
|
||||
|
||||
|
||||
def forearm(L):
|
||||
"""ARM DETAIL (MANIPULATOR) and the hero's left forearm: a faceted housing from the elbow to the wrist, plated
|
||||
on its front and outer faces."""
|
||||
return [
|
||||
("house", house([(-0.12, 0.42, -0.24, 0.22, 0.08), (-0.35, 0.52, -0.3, 0.28, 0.1), (-L + 0.25, 0.48, -0.28, 0.26, 0.1), (-L + 0.08, 0.38, -0.22, 0.2, 0.07)])),
|
||||
("Front", slab((0.0, 0.3, -0.6), (0, 1, 0.03), hexa(0.44, 0.72, 0.1), 0.12, fit=[BOLTS])),
|
||||
("Outer", slab((0.28, 0.0, -0.62), (1, 0, 0.0), hexa(0.5, 0.8, 0.12), 0.12, right=FWD, fit=[BOLTS, ("vents", 0.0, 0.22, 0.26, 0.03, 2)])),
|
||||
("Rear", slab((0.0, -0.3, -0.6), (0, -1, 0.0), hexa(0.4, 0.66, 0.1), 0.1, mat=P2)),
|
||||
]
|
||||
|
||||
|
||||
# the stag's emblem on each thigh's shield (hero: on both), the unit number on each greave
|
||||
MARKS = {("Thigh", "R", "mark"): ("emblem:stag", 0.5), ("Thigh", "L", "mark"): ("emblem:stag", 0.5),
|
||||
("Shin", "R", "mark2"): ("37", 0.2), ("Shin", "L", "mark2"): ("37", 0.2)}
|
||||
TABLES = {"Thigh": thigh, "Shin": shin, "Meta": meta, "UpperArm": upper_arm, "Forearm": forearm}
|
||||
KINDS = {f"{part}.{row[0]}": "hard" for part, fn in TABLES.items() for row in fn(1.5)}
|
||||
|
||||
|
||||
def link_frame(link):
|
||||
"""The table frame of a kit link, in the world: origin on its upper pin, z up the link, y forward, x the mech's
|
||||
right (mechlib.seat at the link's origin, unmirrored)."""
|
||||
M.update()
|
||||
return link.matrix_world @ M.seat(link, (0, 0, 0))
|
||||
|
||||
|
||||
def dress(prefix, link, length, side, seed=0):
|
||||
"""One limb segment's plates on its link: the table TABLES[prefix](length), mirrored for the left."""
|
||||
tag = "R" if side > 0 else "L"
|
||||
return HP.part(prefix, tag, TABLES[prefix](length), link_frame(link), link, side, seed=seed, marks=MARKS, kinds=KINDS)
|
||||
|
||||
|
||||
def hoses(tag, side, thigh_link, shin_link):
|
||||
"""Hero and rear three-quarter: the hose loops behind each knee, from the thigh's rear housing to the shin's."""
|
||||
Ft, Fs = link_frame(thigh_link), link_frame(shin_link)
|
||||
s = side
|
||||
for i, (x, r) in enumerate(((s * 0.3, 0.045), (-s * 0.2, 0.038))):
|
||||
HP.hose(f"Knee{tag}.hose{i}", thigh_link, Ft @ Vector((x, -0.42, -1.25 - 0.1 * i)), Ft.to_3x3() @ Vector((0.6 * (1 if x > 0 else -1), -1, -0.3)),
|
||||
Fs @ Vector((x, -0.36, -0.42 - 0.08 * i)), Fs.to_3x3() @ Vector((0.4 * (1 if x > 0 else -1), -1, 0.5)), r, stiffness=0.6)
|
||||
|
|
@ -10,10 +10,10 @@ numpy; brokkr_reference.core for the flow score.
|
|||
stag_sensor_arrays.png the SENSOR ARRAY DETAIL inset beside our left array at the inset's solved camera
|
||||
stag_components.png the turns, the free cages over their shells, the feet and arms cropped from the turns
|
||||
stag_torso.png the hero's torso: the concept's crop beside ours at the posed hero camera
|
||||
stag_vs_passes.png passes 1 and 2 (PASS1, PASS2: their out/stag) beside pass 3 and the concept: hero,
|
||||
stag_vs_passes.png passes 1 to 3 (PASS1, PASS2, PASS3: their out/stag) beside pass 4 and the concept: hero,
|
||||
rear three-quarter, the arrays alone, the rear elevation
|
||||
The hero renders are the posed build's (STAG_POSE=hero: stag_points_hero.json, stag_skeleton_hero.json); the rest
|
||||
are the stance build's.
|
||||
The hero and rear three-quarter renders are the posed builds' (STAG_POSE=hero, rear3q: stag_points_<view>.json,
|
||||
stag_skeleton_<view>.json); the rest are the stance build's.
|
||||
"""
|
||||
import importlib.util
|
||||
import json
|
||||
|
|
@ -106,11 +106,11 @@ def text_panel(lines, w, h):
|
|||
|
||||
|
||||
def built_points(tag):
|
||||
suffix = "_hero" if tag == "hero" else ""
|
||||
suffix = f"_{tag}" if tag in ("hero", "rear3q") else ""
|
||||
built = json.loads((R / f"stag_skeleton{suffix}.json").read_text(encoding="utf-8"))["built"]
|
||||
built.update(json.loads((R / f"stag_points{suffix}.json").read_text(encoding="utf-8")))
|
||||
if tag == "hero": # the posed points the build does not write (n37, soles' middles) from the solve's own
|
||||
built.update({k: v for k, v in CAMS["hero"]["solved"]["joints"].items() if k not in built})
|
||||
if suffix: # the posed points the build does not write (n37, soles' middles) from the solve's own
|
||||
built.update({k: v for k, v in CAMS[tag]["solved"]["joints"].items() if k not in built})
|
||||
return built
|
||||
|
||||
|
||||
|
|
@ -139,11 +139,12 @@ def camera_sheet():
|
|||
rms = float(np.sqrt(np.mean(np.square(res)))) if res else 0.0
|
||||
lines.append(f"{tag}: model {cam['model']}, lens {cam['lens']:.0f} mm, solve rms {cam['rms']:.1f} px, built joints rms {rms:.1f} px ({len(res)})")
|
||||
rows.append(label(im, f"{tag}: rms {rms:.1f} px"))
|
||||
h = CAMS["hero"]
|
||||
lines.append(f"hero solved with the pose (stag_hero.py): {', '.join(f'{k} {v:.1f}' for k, v in h['solved']['pose'].items())}")
|
||||
lines.append(f"hero eye {h['C'][2]:.2f} m, {h['distance']:.1f} m off, azimuth {h['azimuth']:.0f} (held; the marks leave it open), horizon v {h['horizon']:.0f} (marked {C['marks']['hero_horizon']}); "
|
||||
f"the stance unposed: {h['solved']['stance_rms']:.1f} px")
|
||||
sheet = stack([row(rows, 700), text_panel(lines, 1400, 130)])
|
||||
for tag in ("hero", "rear3q"):
|
||||
h = CAMS[tag]
|
||||
lines.append(f"{tag} solved with the pose (stag_hero.py): " + ", ".join(f"{k} {v:.1f}" for k, v in h["solved"]["pose"].items()))
|
||||
lines.append(f"{tag} eye {h['C'][2]:.2f} m, {h['distance']:.1f} m off, azimuth {h['azimuth']:.0f} (held; the marks leave it open), horizon v {h['horizon']:.0f} "
|
||||
f"(marked {C['marks'][tag + '_horizon']}); both soles on the ground (the hock solved for contact)")
|
||||
sheet = stack([row(rows, 700), text_panel(lines, 1800, 150)])
|
||||
sheet.save(CMP / "stag_camera.png")
|
||||
return lines
|
||||
|
||||
|
|
@ -253,7 +254,8 @@ def torso_sheet():
|
|||
|
||||
|
||||
def passes_sheet():
|
||||
olds = [("pass 1", Path(os.environ.get("PASS1", "F:/aeth-wt/fable-stag/out/stag"))), ("pass 2", Path(os.environ.get("PASS2", "F:/aeth-wt/fable-stag-2/out/stag")))]
|
||||
olds = [("pass 1", Path(os.environ.get("PASS1", "F:/aeth-wt/fable-stag/out/stag"))), ("pass 2", Path(os.environ.get("PASS2", "F:/aeth-wt/fable-stag-2/out/stag"))),
|
||||
("pass 3", Path(os.environ.get("PASS3", "F:/aeth-wt/fable-stag-3/out/stag")))]
|
||||
|
||||
def old(root, stem):
|
||||
q = root / f"{stem}.png"
|
||||
|
|
@ -273,7 +275,7 @@ def passes_sheet():
|
|||
a = old(root, f"full_{stem}")
|
||||
ims += [label(a, name)] if a is not None else []
|
||||
b = render(f"{STAGE}_{stem}")
|
||||
ims += [label(b, "pass 3")] if b is not None else []
|
||||
ims += [label(b, "pass 4")] if b is not None else []
|
||||
rows.append(row(ims, h))
|
||||
stack(rows).save(CMP / "stag_vs_passes.png")
|
||||
|
||||
|
|
|
|||
|
|
@ -854,7 +854,7 @@ def numeral(skin, frame, text="03", height=0.2, mat="marking", font=FONT, spacin
|
|||
|
||||
|
||||
def emblem(skin, frame, kind="wings", height=0.3, mat="marking"):
|
||||
"""UNIT MARK (SERAPH, 30.webp: "wings", the Union Defense Systems blade between swept wings from the sheet's
|
||||
"""UNIT MARK (PALADIN, 27.webp: "triangle", the hollow triangle, point down; SERAPH, 30.webp: "wings", the Union Defense Systems blade between swept wings from the sheet's
|
||||
margin; "roundel", the ringed swoosh on the pauldron's front shield; BREAKER, 24.webp and R-3: "shield", an
|
||||
emblem shield with a chevron). Painted, bent with the plate."""
|
||||
s = height
|
||||
|
|
@ -869,6 +869,14 @@ def emblem(skin, frame, kind="wings", height=0.3, mat="marking"):
|
|||
inner = [(0.43 * math.cos(2 * math.pi * k / 40), 0.43 * math.sin(2 * math.pi * k / 40)) for k in range(40)][::-1]
|
||||
swoosh = [(-0.3, -0.16), (-0.1, -0.3), (0.14, -0.26), (0.3, -0.08), (0.34, 0.16), (0.22, 0.02), (0.06, -0.08), (-0.1, -0.08), (-0.2, 0.02), (-0.24, 0.2), (-0.1, 0.32), (-0.3, 0.26), (-0.36, 0.06)]
|
||||
loops = [outer, inner, swoosh]
|
||||
elif kind == "triangle": # PALADIN, 27.webp: the hollow triangle, point down, on the thigh's shield and the calf block
|
||||
outer = [(-0.5, 0.42), (0.5, 0.42), (0.0, -0.5)]
|
||||
loops = [outer, [(0.72 * x, 0.72 * (y - 0.11) + 0.11) for x, y in outer][::-1]]
|
||||
elif kind == "stag": # STAG, 37.webp: the stag's head and antlers on the thigh shields and the dorsal cover, one outline
|
||||
half = [(0.0, -0.5), (0.07, -0.4), (0.11, -0.08), (0.3, -0.02), (0.31, 0.03), (0.15, 0.06), (0.11, 0.11), (0.2, 0.2), (0.33, 0.26),
|
||||
(0.45, 0.2), (0.49, 0.24), (0.38, 0.33), (0.45, 0.47), (0.41, 0.5), (0.33, 0.38), (0.25, 0.48), (0.21, 0.46), (0.27, 0.34),
|
||||
(0.17, 0.27), (0.07, 0.17), (0.0, 0.16)]
|
||||
loops = [half + [(-x, y) for x, y in reversed(half[1:-1])]]
|
||||
else:
|
||||
heater = [(-0.4, 0.5), (0.4, 0.5), (0.4, 0.05), (0.26, -0.28), (0, -0.5), (-0.26, -0.28), (-0.4, 0.05)]
|
||||
loops = [heater, [(0.86 * x, 0.86 * y + 0.01) for x, y in heater][::-1], [(-0.24, 0.2), (0, -0.02), (0.24, 0.2), (0.24, 0.02), (0, -0.2), (-0.24, 0.02)]]
|
||||
|
|
|
|||
Loading…
Reference in a new issue