| 79 | * Write points3D.bin. |
| 80 | */ |
| 81 | export function writePoints3DBinary(points3D: Map<Point3DId, Point3D>): ArrayBuffer { |
| 82 | const writer = new BinaryWriter(); |
| 83 | |
| 84 | writer.writeUint64FromNumber(points3D.size); |
| 85 | |
| 86 | for (const point3DId of sortedKeys(points3D)) { |
| 87 | const pt = points3D.get(point3DId)!; |
| 88 | |
| 89 | writer.writeUint64(point3DId); |
| 90 | writer.writeFloat64(pt.xyz[0]); |
| 91 | writer.writeFloat64(pt.xyz[1]); |
| 92 | writer.writeFloat64(pt.xyz[2]); |
| 93 | writer.writeUint8(pt.rgb[0]); |
| 94 | writer.writeUint8(pt.rgb[1]); |
| 95 | writer.writeUint8(pt.rgb[2]); |
| 96 | writer.writeFloat64(pt.error); |
| 97 | |
| 98 | writer.writeUint64FromNumber(pt.track.length); |
| 99 | for (const trackEl of pt.track) { |
| 100 | writer.writeUint32(trackEl.imageId); |
| 101 | writer.writeUint32(trackEl.point2DIdx); |
| 102 | } |
| 103 | } |
| 104 | |
| 105 | return writer.toArrayBuffer(); |
| 106 | } |
| 107 | |
| 108 | /** |
| 109 | * Write rigs.bin. |