/** 单测辅助:把示范动作按时间采样成 Pose 序列(文件名不带 .test,不会被当成用例执行) */ import type { Pose } from '../keypoints.ts' import { MOTIONS, type MoveId } from '../motions.ts' export function sampleMotion(id: MoveId, seconds: number, fps = 12, startMs = 0): Pose[] { const spec = MOTIONS[id] const frames: Pose[] = [] const n = Math.round(seconds * fps) for (let i = 0; i < n; i++) { const tSec = i / fps const points = spec.poseAt(tSec / spec.cycleSeconds) frames.push({ points, scores: points.map(() => 0.9), t: startMs + tSec * 1000 }) } return frames }