MCPcopy Create free account
hub / github.com/ColmapView/Colmapview.github.io / formatDouble

Function formatDouble

src/parsers/colmapWriterUtils.ts:20–25  ·  view source on GitHub ↗
(value: number)

Source from the content-addressed store, hash-verified

18 * Both cases are guarded by only trimming when the mantissa contains a '.'.
19 */
20export function formatDouble(value: number): string {
21 const str = value.toPrecision(17);
22 const [mantissa, exponent] = str.split(/e/i);
23 const trimmed = mantissa.includes('.') ? mantissa.replace(/\.?0+$/, '') : mantissa;
24 return exponent !== undefined ? `${trimmed}e${exponent}` : trimmed;
25}
26
27/**
28 * Sort map keys numerically. COLMAP sorts entries by ID before writing.

Callers 5

writeImagesTextFunction · 0.90
writePoints3DTextFunction · 0.90
writeRigsTextFunction · 0.90
writeFramesTextFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected