gizai/models/soma
SOMA's 30 joints as NVIDIA's motion models (ARDY, MotionBricks) read and give a person's motion, 30 frames a second: the joints, their rest pose (a T pose, every turn at rest none), and a frame's features, to and from the frames of a skeleton (gizlang/retarget).
import * as Soma from "gizai/models/soma";Functions
heading
function heading(right: Point3, left: Point3): f64The heading of a body whose thighs are at right and left: the angle about y of its front (0: +z).
Effects: fail.
rotationAt
function rotationAt(v: Vec<f64>, at: i64): RotationThe rotation whose matrix's first two columns are the 6 values of v from at (made orthonormal).
Effects: fail, alloc.
putRotation
function putRotation(v: mut Vec<f64>, at: i64, q: Rotation): voidRotation q as 6 values put in v from at: its matrix's first two columns.
Effects: fail, alloc.
placed
function placed(frames: Vec<f64>, angle: f64, dx: f64, dz: f64): Vec<f64>FRAMES (features) turned by angle about y (a heading grows by it), then moved by (dx, 0, dz).
Effects: fail, alloc.
captured
function captured(features: Vec<f64>): Vec<f64>FEATURES of a motion of NVIDIA's capture skeleton (features of its BVH) as SOMA's: each joint's rotation M
becomes M CAPTUREᵀ, a turn from the T pose.
Effects: fail, read, write, console, io, alloc.
frames
function frames(features: Vec<f64>): FramesFEATURES (frames of REP values) as frames of SOMA's skeleton (gizlang/retarget): each joint's turn from its global rotation made local to its parent's, and the root's place.
Effects: fail, read, write, console, io, alloc.
features
function features(motion: Frames, meters: f64 = 1.0): Vec<f64> throws stringThe features of MOTION, frames of a skeleton that has SOMA's joints by name (their thighs and shins named as
VRM or as SOMA names them) at rest in SOMA's T pose, its lengths in units of meters: each frame's joints placed
and turned through their parents. The velocities are each frame's change to the next (the last frame's, the one
before), the contacts none.
Effects: fail, read, write, alloc.
Constants
FPS
const FPS: f64 = 30.0The frames a second.
JOINTS
const JOINTS: Vec<string> = ["Hips", "Spine1", "Spine2", "Chest", "Neck1", "Neck2", "Head", "Jaw", "LeftEye", "RightEye", "LeftShoulder", "LeftArm", "LeftForeArm", "LeftHand", "LeftHandThumbEnd", "LeftHandMiddleEnd", "RightShoulder", "RightArm", "RightForeArm", "RightHand", "RightHandThumbEnd", "RightHandMiddleEnd", "LeftUpperLeg", "LeftLowerLeg", "LeftFoot", "LeftToeBase", "RightUpperLeg", "RightLowerLeg", "RightFoot", "RightToeBase"]SOMA's 30 joints (somaskel30), parents first, and each one's parent. Its thighs and shins are named as VRM names them (SOMA's own names are Leg and Shin).
PARENTS
const PARENTS: Vec<i64> = [-1, 0, 1, 2, 3, 4, 5, 6, 6, 6, 3, 10, 11, 12, 13, 13, 3, 16, 17, 18, 19, 19, 0, 22, 23, 24, 0, 26, 27, 28]Each joint's parent (-1: the root).
J
const J: i64 = 30The joints.
REP
const REP: i64 = 366A frame's features: the root's place (3) and heading (cos, sin: 0 faces +z), the other joints' places from the root's place on the ground (29 x 3), each joint's global rotation as 6 values (the first two columns of its matrix; 30 x 6), the joints' velocities (30 x 3) and the foot contacts (left heel and toe, right heel and toe).
ROOT
const ROOT: i64 = 5The root's values of a frame (place and heading), before the other joints' places.
PLACES
const PLACES: i64 = 5The places of joints 1.. from the root's place on the ground.
TURNS
const TURNS: i64 = 92The global rotations.
VELOCITIES
const VELOCITIES: i64 = 272The velocities.
CONTACTS
const CONTACTS: i64 = 362The foot contacts.