(frames: Map<FrameId, Frame>)
| 157 | } |
| 158 | |
| 159 | export function writeFramesText(frames: Map<FrameId, Frame>): string { |
| 160 | const lines: string[] = []; |
| 161 | |
| 162 | lines.push('# Frame list with one line of data per frame'); |
| 163 | lines.push('# FRAME_ID, RIG_ID, QW, QX, QY, QZ, TX, TY, TZ, NUM_DATA_IDS'); |
| 164 | lines.push('# SENSOR_TYPE, SENSOR_ID, DATA_ID'); |
| 165 | lines.push(`# Number of frames: ${frames.size}`); |
| 166 | |
| 167 | for (const frameId of sortedKeys(frames)) { |
| 168 | const frame = frames.get(frameId)!; |
| 169 | const [qw, qx, qy, qz] = frame.rigFromWorld.qvec; |
| 170 | const [tx, ty, tz] = frame.rigFromWorld.tvec; |
| 171 | |
| 172 | lines.push( |
| 173 | [ |
| 174 | frameId, |
| 175 | frame.rigId, |
| 176 | formatDouble(qw), |
| 177 | formatDouble(qx), |
| 178 | formatDouble(qy), |
| 179 | formatDouble(qz), |
| 180 | formatDouble(tx), |
| 181 | formatDouble(ty), |
| 182 | formatDouble(tz), |
| 183 | frame.dataIds.length, |
| 184 | ].join(' ') |
| 185 | ); |
| 186 | |
| 187 | for (const dataMapping of frame.dataIds) { |
| 188 | lines.push( |
| 189 | `${dataMapping.sensorId.type} ${dataMapping.sensorId.id} ${dataMapping.dataId}` |
| 190 | ); |
| 191 | } |
| 192 | } |
| 193 | |
| 194 | return lines.join('\n') + '\n'; |
| 195 | } |
no test coverage detected