/ simulated_instruments / triangle
Sign in
simulated_instruments / triangle
triangle / webapp / src / components / DiagnosticsPanel.tsx
65 lines · 2.0 KBCodeBlameHistory
4c0259bAdd instrument/: the triangle behind the track-render interfaceJeremy Magland 1import type { RenderResult } from '../hooks/useRenderer';
4c0259bAdd instrument/: the triangle behind the track-render interfaceJeremy Magland 3export default function DiagnosticsPanel({ result }: { result: RenderResult }) {
96aec9cTriangle strike simulator: MATLAB model and interactive web appJeremy Magland 4 const d = result.diag;
5 const modes = Array.from(result.modeF);
6 const shown = modes.slice(0, 10);
7 return (
8 <div className="diag">
9 <table>
10 <tbody>
11 <tr>
12 <th>Strikes</th>
13 <td>
14 {d.strikeCount === 1
15 ? `single, ${d.meanV.toFixed(2)} m/s`
16 : `${d.strikeCount} · mean ${d.meanV.toFixed(2)} m/s, max ${d.maxV.toFixed(2)} m/s`}
17 </td>
18 </tr>
19 <tr>
20 <th>Contact</th>
21 <td>
22 {d.meanTauUs.toFixed(0)} µs mean (Hertz) · peak force {d.peakForceN.toFixed(0)} N
23 </td>
24 </tr>
25 <tr>
26 <th>Rod modes</th>
27 <td className="partials">
28 {shown.map((f) => f.toFixed(0)).join(', ')}
29 {modes.length > shown.length ? `, … (${modes.length} total)` : ''} Hz
30 </td>
31 </tr>
32 <tr>
33 <th>Families</th>
34 <td>
35 {d.modesIn} in-plane, {d.modesOut} out-of-plane
36 </td>
37 </tr>
38 <tr>
39 <th>Listener</th>
40 <td>{(d.listenerDistM * 100).toFixed(0)} cm from the frame</td>
41 </tr>
42 <tr>
43 <th>Peak pressure</th>
44 <td>
45 {d.peakPa.toFixed(3)} Pa ({d.peakSplDb.toFixed(1)} dB SPL)
46 </td>
47 </tr>
48 <tr>
49 <th>Length</th>
50 <td>
51 {d.durationS.toFixed(2)} s · {result.quality} · oversample {d.oversample}
52 </td>
53 </tr>
54 </tbody>
55 </table>
56 <div className="cachenote">
57 eigensolve: {d.solveCached ? 'cached' : `${(d.solveMs / 1000).toFixed(2)} s`} · radiation:{' '}
58 {d.radiateCached ? 'cached' : `${(d.radiateMs / 1000).toFixed(2)} s`}
59 </div>
60 {d.warnings.map((w, i) => (
61 <div key={i} className="warning">⚠ {w}</div>
62 ))}
63 </div>
64 );
↑↓ move↵openescclose