MCPcopy Index your code
hub / github.com/ColmapView/Colmapview.github.io / writeFramesText

Function writeFramesText

src/parsers/colmapTextWriters.ts:159–195  ·  view source on GitHub ↗
(frames: Map<FrameId, Frame>)

Source from the content-addressed store, hash-verified

157}
158
159export 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}

Calls 3

sortedKeysFunction · 0.90
formatDoubleFunction · 0.90
getMethod · 0.80

Tested by

no test coverage detected