Render Anything Engine: tell your AI what to make. Videos, motion graphics, 3D and games as React and TypeScript, rendered on your own GPU. Rust + Bevy, macOS, Linux and Windows.
TypeScript 3dagent-skillsai-agentsai-videobevyclaude-codegame-enginegpulinuxmacosmotion-designmotion-graphicsreactrusttypescriptvideo-editingvideo-renderingwgpuwindows
HG14: a thumb that is in the thing is spread out from the palm until it is clear; a leaving hand stays on its cleared path for longer; character.take answers reach (whether the body can take the thing from where it stands, and how far it must move if not). On turbo's skin: skin in the table 0 mm in four of six takes, finger jumps 67 to 242 degrees a second. The body-only JSON calls (character.fit, character.hand) and the readers the calls share are raea-sys-body's
shinyobjectz20ccabb8dd52
diff --git a/docs/hands.feature b/docs/hands.featureindex 46be2b20..1bc4b719 100644--- a/docs/hands.feature+++ b/docs/hands.feature@@ -63,7 +63,8 @@ Feature: Procedural arms and hands: a character reaches for, takes, holds, carri| raea-sys-grab | src/interact.rs | 40 | which thing is taken || raea-sys-grab | src/take.rs | 460 | the take's timeline, each hand's part, the frame's solve || raea-sys-grab | src/grip.rs | 110 | the hand's lie at its grab, the swivel, an arm past its ranges |- | raea-sys-grab | src/json.rs | 190 | character.take, character.fit, character.hand |+ | raea-sys-grab | src/json.rs | 150 | character.take |+ | raea-sys-body | src/json.rs | 90 | character.fit, character.hand, the readers the calls share || raea-sys-grab | tests/grab.rs | 470 | the hands' measures, on the stand-in body || raea-sys-grab | tests/body.rs | 150 | limits, the body out of solids, the hand prior || raea-sys-grab | tests/use.rs | 230 | passing, sliding, wind-up, a turned body, keeping out of solids |@@ -342,6 +343,15 @@ Feature: Procedural arms and hands: a character reaches for, takes, holds, carri# floor take (hold 83 mm off as the box is pushed clear of the squatting body, fingers 25 mm in it, thighs# 18 mm in it); the mug (fingers 25 mm in it, a thumb that starts inside it); fingers 9 to 11 mm in the# table as a hand leaves; body-joint jumps of 360 to 700; `limited` on about 100 frames a take.+ # Fourth run, after: a limb's middle joint flexing about its own axis (the first bone turned in its socket),+ # which ended the false limits (0 frames in three takes, 31 to 76 in the others); the body following the+ # hands down; the knees opening for a low thing between the feet; a thumb that is in the thing spread out+ # from the palm until it is clear; a leaving hand kept on its cleared path for longer. Skin in the table 0+ # mm in four takes (9 in the floor take); finger jumps 67 to 242. character.take now answers `reach`:+ # whether the body can take the thing from where it stands, and how far it must move if not. Still wrong:+ # the floor take (hold 69 mm off, fingers 26 mm in the box, thighs 11 mm); the mug (fingers 26 mm in it);+ # body-joint jumps of 360 to 640. Shown on turbo in the Character SDK project (compositions/take_turbo.tsx),+ # rendered before this run.Given the six takes of tools/hands-audit on a clean body with real fingersThen no skin is in the thing beyond a pad's give (2 mm), none in the scene or the bodyAnd every finger meant to hold has its pad on the thing, by a grip chosen for the thing's size and shapediff --git a/sdk/character/src/take.ts b/sdk/character/src/take.tsindex 965f9fda..e2f1e454 100644--- a/sdk/character/src/take.ts+++ b/sdk/character/src/take.ts@@ -80,6 +80,9 @@ export interface Taken {/** where the body would stand to take the thing, and the turn about the vertical that faces it: walk it there first* when the thing is out of reach */stand: { at: Vec3; yaw: number };+ /** whether the body can take the thing from where it stands when it starts to reach, and if not how far it has to+ * move (to `stand`), metres */+ reach: { ok: boolean; move: number };}/** The body and the thing at `t` seconds of a take. */diff --git a/systems/body/src/json.rs b/systems/body/src/json.rsnew file mode 100644index 00000000..6c3fea52--- /dev/null+++ b/systems/body/src/json.rs@@ -0,0 +1,75 @@+//! Poses fitted to points and hands shaped by number, asked for as JSON: the engine's native calls character.fit and+//! character.hand (raea/character's fitPose and handShape); and the readers the hands' calls share.++use glam::{Quat, Vec3};+use serde_json::{Value, json};++use crate::fit::{Mark, fit};+use crate::prior::{coefficients, oddness, shape};+use crate::rig::{Side, Skeleton};++pub fn num(v: &Value, what: &str) -> Result<f32, String> {+ v.as_f64().map(|n| n as f32).ok_or_else(|| format!("character.take: {what} isn't a number"))+}++pub fn vec3(v: &Value, what: &str) -> Result<Vec3, String> {+ let a = v.as_array().filter(|a| a.len() == 3).ok_or_else(|| format!("character.take: {what} isn't [x, y, z]"))?;+ Ok(Vec3::new(num(&a[0], what)?, num(&a[1], what)?, num(&a[2], what)?))+}++pub fn quat(v: &Value, what: &str) -> Result<Quat, String> {+ let a = v.as_array().filter(|a| a.len() == 4).ok_or_else(|| format!("character.take: {what} isn't [x, y, z, w]"))?;+ Ok(Quat::from_xyzw(num(&a[0], what)?, num(&a[1], what)?, num(&a[2], what)?, num(&a[3], what)?).normalize())+}++pub const FIT_ARGS: &str = "{ joints: { name: string; parent: number; head: [number, number, number]; tail: [number, number, number] }[]; marks: { joint: string; offset?: [number, number, number]; at: [number, number, number]; weight?: number }[]; from?: { root: [number, number, number]; turns: [number, number, number, number][] }; passes?: number }";+pub const FIT_ANSWER: &str = "{ pose: { root: [number, number, number]; turns: [number, number, number, number][] }; miss: number }";++/// `character.fit`: a pose fitted to points of the body seen somewhere (fit.rs).+pub fn fit_json(v: &Value) -> Result<Value, String> {+ let skel = Skeleton::from_value(v)?;+ let mut from = skel.rest();+ if !v["from"].is_null() {+ from.root = vec3(&v["from"]["root"], "from.root")?;+ for (slot, turn) in from.turns.iter_mut().zip(v["from"]["turns"].as_array().into_iter().flatten()) {+ *slot = quat(turn, "from's turn")?;+ }+ }+ let mut marks = Vec::new();+ for m in v["marks"].as_array().ok_or("character.fit: no marks")? {+ let name = m["joint"].as_str().ok_or("character.fit: a mark names no joint")?;+ let joint = skel.joint(name).ok_or_else(|| format!("character.fit: the body has no joint {name}"))?;+ let offset = if m["offset"].is_null() { Vec3::ZERO } else { vec3(&m["offset"], "a mark's offset")? };+ let weight = if m["weight"].is_null() { 1.0 } else { num(&m["weight"], "a mark's weight")? };+ marks.push(Mark { joint, offset, at: vec3(&m["at"], "a mark's at")?, weight });+ }+ let passes = v["passes"].as_u64().unwrap_or(8) as usize;+ let (pose, miss) = fit(&skel, &from, &marks, passes);+ let turns: Vec<[f32; 4]> = pose.turns.iter().map(|q| q.to_array()).collect();+ Ok(json!({ "pose": { "root": pose.root.to_array(), "turns": turns }, "miss": miss }))+}++pub const HAND_ARGS: &str = "{ joints: { name: string; parent: number; head: [number, number, number]; tail: [number, number, number] }[]; side: \"L\" | \"R\"; z?: number[]; pose?: { root: [number, number, number]; turns: [number, number, number, number][] } }";+pub const HAND_ANSWER: &str = "{ pose: { root: [number, number, number]; turns: [number, number, number, number][] }; z: number[]; odd: number }";++/// `character.hand`: a hand shaped by the hand prior's coefficients (prior.rs) on a pose, and that hand read back:+/// its coefficients and how odd it is.+pub fn hand_json(v: &Value) -> Result<Value, String> {+ let skel = Skeleton::from_value(v)?;+ let side = if v["side"] == "L" { Side::L } else { Side::R };+ let mut pose = skel.rest();+ if !v["pose"].is_null() {+ pose.root = vec3(&v["pose"]["root"], "pose.root")?;+ for (slot, turn) in pose.turns.iter_mut().zip(v["pose"]["turns"].as_array().into_iter().flatten()) {+ *slot = quat(turn, "the pose's turn")?;+ }+ }+ if let Some(z) = v["z"].as_array() {+ let z = z.iter().map(|n| num(n, "a number of z")).collect::<Result<Vec<f32>, String>>()?;+ shape(&skel, &mut pose.turns, side, &z).ok_or("character.hand: the body has no hand on that side")?;+ }+ let (z, _) = coefficients(&skel, &pose, side).ok_or("character.hand: the body has no hand on that side")?;+ let odd = oddness(&skel, &pose, side).unwrap_or(0.0);+ let turns: Vec<[f32; 4]> = pose.turns.iter().map(|q| q.to_array()).collect();+ Ok(json!({ "pose": { "root": pose.root.to_array(), "turns": turns }, "z": z, "odd": odd }))+}diff --git a/systems/body/src/lib.rs b/systems/body/src/lib.rsindex b74635d5..07e077a7 100644--- a/systems/body/src/lib.rs+++ b/systems/body/src/lib.rs@@ -7,10 +7,12 @@//! - `limits`: each joint's range as anatomical angles (sdk/body's), a turn brought inside it, a pose's violations.//! - `fit`: a pose fitted to points seen (SOMA-X's analytical pose inversion), for motion that arrives as positions.//! - `shape`: a solid as a signed distance: ray casts, normals, clearance.+//! - `json`: character.fit and character.hand, asked for as JSON.//! - `prior`: SOMA-X's hand pose prior on raea's fingers: a hand's shape from a few numbers, and how odd a hand is.pub mod arm;pub mod fit;+pub mod json;pub mod limits;pub mod prior;pub mod rig;@@ -18,6 +20,7 @@ pub mod shape;pub use arm::{ArmOptions, IkReport, forearm_twist, reach, twist_joints, two_bone};pub use fit::{Mark, fit, marks_of};+pub use json::{FIT_ANSWER, FIT_ARGS, HAND_ANSWER, HAND_ARGS, fit_json, hand_json};pub use limits::{Angles, angles_of, clamp_turn, violations};pub use shape::{Hit, Solid, Thing};pub use rig::{HandRest, Pose, Posed, Sample, Side, Skeleton, hand_rest, mannequin};diff --git a/systems/grab/src/hand.rs b/systems/grab/src/hand.rsindex 8512ab11..749399d2 100644--- a/systems/grab/src/hand.rs+++ b/systems/grab/src/hand.rs@@ -137,11 +137,12 @@ pub fn curl(skel: &Skeleton, turns: &mut [Quat], wrist: (Vec3, Quat), s: Side, tlet toward = if thumb { (skel.joints[hand].head + rest.mid + rest.palm * 0.05 - j.head).normalize() } else { rest.palm };bone.cross(toward).normalize_or(Vec3::X)};- let base = [turns[js[0]], turns[js[1]], turns[js[2]]];+ let own = [turns[js[0]], turns[js[1]], turns[js[2]]];+ let mut base = own;// each bone's own skin, where the body has samples of it (from the bone's head, at rest)let skin = js.map(|j| skel.skin_of(j).map(|x| x.at - skel.joints[j].head).collect::<Vec<Vec3>>());// the least clearance of bone k's skin with the finger bent by `bend` (radians a joint)- let clear = |bend: [f32; 3], k: usize| {+ let clear = |base: &[Quat; 3], bend: [f32; 3], k: usize| {let (mut pp, mut pr) = wrist;let mut least = f32::MAX;for i in 0..=k {@@ -164,10 +165,25 @@ pub fn curl(skel: &Skeleton, turns: &mut [Quat], wrist: (Vec3, Quat), s: Side, t// each joint starts opened and bends until its bone meets the surface (the last step halved down to the// contact), so the finger wraps whatever is there; the joints after it wait opened, out of the waylet open = OPEN[thumb as usize].map(f32::to_radians);+ // a thumb that is in the thing even opened is spread out from the palm (turned about the hand's length, the+ // less of the two ways, up to 60 degrees) until it is clear: round a cup, not through it+ if thumb {+ let worst = |b: &[Quat; 3]| (0..3).map(|k| clear(b, open, k)).fold(f32::MAX, f32::min);+ if worst(&base) < 0.0 {+ let spread = |by: f32| {+ let mut b = own;+ b[0] = (own[0] * Quat::from_axis_angle(rest.along, by.to_radians())).normalize();+ b+ };+ if let Some(by) = (1..=12).flat_map(|a| [a as f32 * 5.0, a as f32 * -5.0]).find(|by| worst(&spread(*by)) >= 0.0) {+ base = spread(by);+ }+ }+ }let mut bend = open;for k in 0..3 {let most = BEND[thumb as usize][k].to_radians();- let start = clear(bend, k);+ let start = clear(&base, bend, k);if start < 0.0 {// in the thing even opened: nothing a curl can fix; said, not hiddentouch.inside = touch.inside.max(-start);@@ -181,7 +197,7 @@ pub fn curl(skel: &Skeleton, turns: &mut [Quat], wrist: (Vec3, Quat), s: Side, twhile lo < most {let hi = (lo + step).min(most);bend[k] = hi;- let gap = clear(bend, k);+ let gap = clear(&base, bend, k);if gap < 0.0 {hit = Some(hi);break;@@ -196,7 +212,7 @@ pub fn curl(skel: &Skeleton, turns: &mut [Quat], wrist: (Vec3, Quat), s: Side, tfor _ in 0..8 {let mid = (lo + hi) / 2.0;bend[k] = mid;- if clear(bend, k) < 0.0 { hi = mid } else { lo = mid }+ if clear(&base, bend, k) < 0.0 { hi = mid } else { lo = mid }}bend[k] = lo;touch.on[n] = true;@@ -210,7 +226,9 @@ pub fn curl(skel: &Skeleton, turns: &mut [Quat], wrist: (Vec3, Quat), s: Side, t}}for k in 0..3 {- turns[js[k]] = (base[k] * Quat::from_axis_angle(axis(k), bend[k] * close.clamp(0.0, 1.0))).normalize();+ // (from the pose's own turn, so a spread thumb eases out as the hand shuts)+ let shut = (base[k] * Quat::from_axis_angle(axis(k), bend[k])).normalize();+ turns[js[k]] = own[k].slerp(shut, close.clamp(0.0, 1.0));}}Some(touch)diff --git a/systems/grab/src/json.rs b/systems/grab/src/json.rsindex 49b93a53..3a9108d5 100644--- a/systems/grab/src/json.rs+++ b/systems/grab/src/json.rs@@ -2,33 +2,18 @@//! makes each frame. The body's own motion comes as its poses at the times the take reads it (the frame's, the//! grab's, the release's); the answer is the pose to draw and where the thing is.-use glam::{Quat, Vec3};+use glam::Quat;+use raea_sys_body::json::{num, quat, vec3};use serde_json::{Value, json};use crate::trunk::stand_for;-use raea_sys_body::fit::{Mark, fit};-use raea_sys_body::prior::{coefficients, oddness, shape};use crate::hand::{Grip, Hold, HoldOptions, find_holds};use raea_sys_body::rig::{Pose, Side, Skeleton};use raea_sys_body::shape::{Solid, Thing};use crate::take::{Key, Release, Take, perform};pub const TAKE_ARGS: &str = "{ joints: { name: string; parent: number; head: [number, number, number]; tail: [number, number, number] }[]; t: number; base: { t: number; root: [number, number, number]; turns: [number, number, number, number][] }[]; thing: { ball?: number; box?: [number, number, number]; capsule?: [number, number]; cylinder?: [number, number]; at: [number, number, number]; turn?: [number, number, number, number] }; start: number; grab?: number; carried?: number; carry?: [number, number, number]; hand?: \"L\" | \"R\"; lower?: number; holds?: { side: \"L\" | \"R\"; at: [number, number, number]; normal: [number, number, number]; along?: [number, number, number]; shape?: number[] }[]; path?: { t: number; carry: [number, number, number]; tilt?: [number, number, number, number] }[]; weight?: number; pass?: number; slide?: { t: number; at: [number, number, number]; turn?: [number, number, number, number] }[]; leave?: number; avoid?: { ball?: number; box?: [number, number, number]; capsule?: [number, number]; cylinder?: [number, number]; at: [number, number, number]; turn?: [number, number, number, number] }[]; put?: { at: number; down: number; place: [number, number, number] }; throw?: { at: number; velocity: [number, number, number]; floor?: number } }";-pub const TAKE_ANSWER: &str = "{ pose: { root: [number, number, number]; turns: [number, number, number, number][] }; thing: { at: [number, number, number]; turn: [number, number, number, number] }; phase: \"Before\" | \"Reach\" | \"Lift\" | \"Carry\" | \"Release\" | \"After\"; hands: 1 | 2; miss: number; moved: number; limited: boolean; stand: { at: [number, number, number]; yaw: number } }";--fn num(v: &Value, what: &str) -> Result<f32, String> {- v.as_f64().map(|n| n as f32).ok_or_else(|| format!("character.take: {what} isn't a number"))-}--fn vec3(v: &Value, what: &str) -> Result<Vec3, String> {- let a = v.as_array().filter(|a| a.len() == 3).ok_or_else(|| format!("character.take: {what} isn't [x, y, z]"))?;- Ok(Vec3::new(num(&a[0], what)?, num(&a[1], what)?, num(&a[2], what)?))-}--fn quat(v: &Value, what: &str) -> Result<Quat, String> {- let a = v.as_array().filter(|a| a.len() == 4).ok_or_else(|| format!("character.take: {what} isn't [x, y, z, w]"))?;- Ok(Quat::from_xyzw(num(&a[0], what)?, num(&a[1], what)?, num(&a[2], what)?, num(&a[3], what)?).normalize())-}+pub const TAKE_ANSWER: &str = "{ pose: { root: [number, number, number]; turns: [number, number, number, number][] }; thing: { at: [number, number, number]; turn: [number, number, number, number] }; phase: \"Before\" | \"Reach\" | \"Lift\" | \"Carry\" | \"Release\" | \"After\"; hands: 1 | 2; miss: number; moved: number; limited: boolean; stand: { at: [number, number, number]; yaw: number }; reach: { ok: boolean; move: number } }";fn solid(v: &Value) -> Result<Solid, String> {if !v["ball"].is_null() {@@ -138,6 +123,8 @@ pub fn take_json(v: &Value) -> Result<Value, String> {let f = perform(&skel, &own, &take, num(&v["t"], "t")?);// where the body would stand to take it, for a scene that walks it there firstlet (stand, facing) = stand_for(&thing, own(start).root);+ // whether the body can take it from where it stands when it starts to reach: at the grab, every wrist on its hold+ let in_reach = perform(&skel, &own, &take, take.grab).miss < 0.02;let turns: Vec<[f32; 4]> = f.pose.turns.iter().map(|q| q.to_array()).collect();Ok(json!({"pose": { "root": f.pose.root.to_array(), "turns": turns },@@ -148,57 +135,6 @@ pub fn take_json(v: &Value) -> Result<Value, String> {"moved": f.moved,"limited": f.limited,"stand": { "at": stand.to_array(), "yaw": facing },+ "reach": { "ok": in_reach, "move": if in_reach { 0.0 } else { (stand - own(start).root).length() } },}))}--pub const FIT_ARGS: &str = "{ joints: { name: string; parent: number; head: [number, number, number]; tail: [number, number, number] }[]; marks: { joint: string; offset?: [number, number, number]; at: [number, number, number]; weight?: number }[]; from?: { root: [number, number, number]; turns: [number, number, number, number][] }; passes?: number }";-pub const FIT_ANSWER: &str = "{ pose: { root: [number, number, number]; turns: [number, number, number, number][] }; miss: number }";--/// `character.fit`: a pose fitted to points of the body seen somewhere (fit.rs).-pub fn fit_json(v: &Value) -> Result<Value, String> {- let skel = Skeleton::from_value(v)?;- let mut from = skel.rest();- if !v["from"].is_null() {- from.root = vec3(&v["from"]["root"], "from.root")?;- for (slot, turn) in from.turns.iter_mut().zip(v["from"]["turns"].as_array().into_iter().flatten()) {- *slot = quat(turn, "from's turn")?;- }- }- let mut marks = Vec::new();- for m in v["marks"].as_array().ok_or("character.fit: no marks")? {- let name = m["joint"].as_str().ok_or("character.fit: a mark names no joint")?;- let joint = skel.joint(name).ok_or_else(|| format!("character.fit: the body has no joint {name}"))?;- let offset = if m["offset"].is_null() { Vec3::ZERO } else { vec3(&m["offset"], "a mark's offset")? };- let weight = if m["weight"].is_null() { 1.0 } else { num(&m["weight"], "a mark's weight")? };- marks.push(Mark { joint, offset, at: vec3(&m["at"], "a mark's at")?, weight });- }- let passes = v["passes"].as_u64().unwrap_or(8) as usize;- let (pose, miss) = fit(&skel, &from, &marks, passes);- let turns: Vec<[f32; 4]> = pose.turns.iter().map(|q| q.to_array()).collect();- Ok(json!({ "pose": { "root": pose.root.to_array(), "turns": turns }, "miss": miss }))-}--pub const HAND_ARGS: &str = "{ joints: { name: string; parent: number; head: [number, number, number]; tail: [number, number, number] }[]; side: \"L\" | \"R\"; z?: number[]; pose?: { root: [number, number, number]; turns: [number, number, number, number][] } }";-pub const HAND_ANSWER: &str = "{ pose: { root: [number, number, number]; turns: [number, number, number, number][] }; z: number[]; odd: number }";--/// `character.hand`: a hand shaped by the hand prior's coefficients (prior.rs) on a pose, and that hand read back:-/// its coefficients and how odd it is.-pub fn hand_json(v: &Value) -> Result<Value, String> {- let skel = Skeleton::from_value(v)?;- let side = if v["side"] == "L" { Side::L } else { Side::R };- let mut pose = skel.rest();- if !v["pose"].is_null() {- pose.root = vec3(&v["pose"]["root"], "pose.root")?;- for (slot, turn) in pose.turns.iter_mut().zip(v["pose"]["turns"].as_array().into_iter().flatten()) {- *slot = quat(turn, "the pose's turn")?;- }- }- if let Some(z) = v["z"].as_array() {- let z = z.iter().map(|n| num(n, "a number of z")).collect::<Result<Vec<f32>, String>>()?;- shape(&skel, &mut pose.turns, side, &z).ok_or("character.hand: the body has no hand on that side")?;- }- let (z, _) = coefficients(&skel, &pose, side).ok_or("character.hand: the body has no hand on that side")?;- let odd = oddness(&skel, &pose, side).unwrap_or(0.0);- let turns: Vec<[f32; 4]> = pose.turns.iter().map(|q| q.to_array()).collect();- Ok(json!({ "pose": { "root": pose.root.to_array(), "turns": turns }, "z": z, "odd": odd }))-}diff --git a/systems/grab/src/lib.rs b/systems/grab/src/lib.rsindex 8a7fd49d..1e11d86f 100644--- a/systems/grab/src/lib.rs+++ b/systems/grab/src/lib.rs@@ -21,6 +21,7 @@ pub mod trunk;pub use hand::{Grip, Hold, HoldOptions, Touch, curl, find_holds, wrist_for};pub use interact::pick;-pub use json::{FIT_ANSWER, FIT_ARGS, HAND_ANSWER, HAND_ARGS, TAKE_ANSWER, TAKE_ARGS, fit_json, hand_json, take_json};+pub use json::{TAKE_ANSWER, TAKE_ARGS, take_json};+pub use raea_sys_body::json::{FIT_ANSWER, FIT_ARGS, HAND_ANSWER, HAND_ARGS, fit_json, hand_json};pub use take::{Frame, Key, Phase, Release, Take, perform};pub use trunk::{clear, hand_points, look, own_solids, roomy, spread_for, stand_for, stoop, torso};diff --git a/systems/grab/src/take.rs b/systems/grab/src/take.rsindex f1fe142a..c98844f8 100644--- a/systems/grab/src/take.rs+++ b/systems/grab/src/take.rs@@ -98,7 +98,7 @@ pub struct Frame {const GRAVITY: f32 = 9.81;/// how long the hands take to go back to the body's own motion after letting go, seconds-const AWAY: f32 = 0.5;+const AWAY: f32 = 0.6;/// how long the fingers take to shut, ending at the grab, secondsconst SHUT: f32 = 0.25;/// how long a throw's wind-up is, ending at the release, seconds@@ -466,7 +466,7 @@ pub fn perform(skel: &Skeleton, base: &dyn Fn(f32) -> Pose, take: &Take, t: f32)let of_arm = |name: &str, side: &str| name.ends_with(side) && !["thigh", "calf", "foot", "ball"].iter().any(|leg| name.starts_with(leg));let sides: Vec<String> = holds.iter().map(|h| format!("_{}", h.0.hold.side.sx())).collect();for (&(part, _, away, ..), side) in holds.iter().zip(&sides) {- let w = smooth(span(t, part.start, part.start + 0.15)) * (1.0 - smooth(span(away, 0.25, 1.0)));+ let w = smooth(span(t, part.start, part.start + 0.15)) * (1.0 - smooth(span(away, 0.45, 1.0)));most = most.max(w);for (i, joint) in skel.joints.iter().enumerate() {if of_arm(&joint.name, side) {