Datasets:
Download code/evaluation-code/ent400-a06a1576/apps/console/web/src/visual.ts from VEHwang/cocogni4d: direct link, hf CLI and curl.
- Browser
- Download file 2.45 kB
-
https://huggingface.co/datasets/VEHwang/cocogni4d/resolve/main/code/evaluation-code/ent400-a06a1576/apps/console/web/src/visual.ts
- Command line
-
hf download hf://datasets/VEHwang/cocogni4d/code/evaluation-code/ent400-a06a1576/apps/console/web/src/visual.ts
-
curl -L -o visual.ts https://huggingface.co/datasets/VEHwang/cocogni4d/resolve/main/code/evaluation-code/ent400-a06a1576/apps/console/web/src/visual.ts
2.45 kB
| import type { Actor, StateName } from './contract.ts'; | |
| // Shape encodes the class (moving subject vs observer); Okabe–Ito color encodes the instance by stable order. | |
| export const COLORS = ['#0072B2', '#D55E00', '#009E73', '#CC79A7', '#E69F00', '#564BA6', '#56B4E9', '#6F6523', '#8B4130', '#304C69']; | |
| export const SHAPES = ['circle', 'square', 'triangle', 'diamond', 'star', 'hexagon'] as const; | |
| export function actorStyle({order, kind}: Pick<Actor, 'order' | 'kind'>) { | |
| if (!Number.isInteger(order) || order < 0) throw Error('主体顺序无效'); | |
| const shape: typeof SHAPES[number] = kind.startsWith('observer') ? 'triangle' : 'circle'; | |
| return {color: COLORS[order % COLORS.length], shape}; | |
| } | |
| export function shapePath(shape: typeof SHAPES[number]): string { | |
| if (shape === 'circle') return 'M 1 0 A 1 1 0 1 0 -1 0 A 1 1 0 1 0 1 0 Z'; | |
| if (shape === 'square') return 'M -.82 -.82 H .82 V .82 H -.82 Z'; | |
| if (shape === 'triangle') return 'M 0 -1.15 L 1 .7 L -1 .7 Z'; | |
| if (shape === 'diamond') return 'M 0 -1.18 L 1.05 0 L 0 1.18 L -1.05 0 Z'; | |
| const count = shape === 'star' ? 10 : 6; | |
| return Array.from({length: count}, (_, i) => { | |
| const radius = shape === 'star' && i % 2 ? .5 : 1.1, angle = -Math.PI / 2 + i * Math.PI * 2 / count; | |
| return `${i ? 'L' : 'M'} ${Math.cos(angle) * radius} ${Math.sin(angle) * radius}`; | |
| }).join(' ') + ' Z'; | |
| } | |
| export const STATE_LABELS: Record<StateName, string> = { | |
| moving: '在走', turning: '原地转身', yield_wait: '让行等待', planned_stay: '计划停留', | |
| station: '驻守', idle_remainder: '剩余原地', unclassified: '未分类', uncovered: '记录未覆盖', | |
| forced_idle: '失败后被迫原地', retargeting: '换目标', | |
| }; | |
| export const KIND_LABELS: Record<string, string> = { | |
| humanoid: '人形', robot: '机器人', observer_embodied: '实体观察者', observer_virtual: '虚拟观察者', | |
| }; | |
| export const INTENT_LABELS: Record<string, string> = {go_to: '前往', stay: '停留', wait: '等待', station: '驻守', | |
| look_around: '环顾', pass_through: '穿过', revisit: '再访', follow: '跟随', patrol: '巡视', back: '回退'}; | |
| export const STATUS_LABELS = {completed: '完成', discarded: '丢弃', truncated: '截断', retreat: '回退'}; | |
| export const CONCLUSION_LABELS: Record<string, string> = {pass: '通过', fail: '失败', not_checked: '未检查', activity_defect: '活动缺陷', validity_defect: '有效性缺陷', view_unusable: '画面不可用'}; | |