| 446 | } |
| 447 | |
| 448 | void WritePoints3DBinary(const Reconstruction& reconstruction, |
| 449 | std::ostream& stream) { |
| 450 | THROW_CHECK(stream.good()); |
| 451 | |
| 452 | WriteBinaryLittleEndian<uint64_t>(&stream, reconstruction.NumPoints3D()); |
| 453 | |
| 454 | for (const point3D_t point3D_id : |
| 455 | ExtractSortedIds(reconstruction.Points3D())) { |
| 456 | const Point3D& point3D = reconstruction.Point3D(point3D_id); |
| 457 | |
| 458 | WriteBinaryLittleEndian<point3D_t>(&stream, point3D_id); |
| 459 | WriteBinaryLittleEndian<double>(&stream, point3D.xyz(0)); |
| 460 | WriteBinaryLittleEndian<double>(&stream, point3D.xyz(1)); |
| 461 | WriteBinaryLittleEndian<double>(&stream, point3D.xyz(2)); |
| 462 | WriteBinaryLittleEndian<uint8_t>(&stream, point3D.color(0)); |
| 463 | WriteBinaryLittleEndian<uint8_t>(&stream, point3D.color(1)); |
| 464 | WriteBinaryLittleEndian<uint8_t>(&stream, point3D.color(2)); |
| 465 | WriteBinaryLittleEndian<double>(&stream, point3D.error); |
| 466 | |
| 467 | WriteBinaryLittleEndian<uint64_t>(&stream, point3D.track.Length()); |
| 468 | for (const TrackElement& track_el : point3D.track.Elements()) { |
| 469 | WriteBinaryLittleEndian<image_t>(&stream, track_el.image_id); |
| 470 | WriteBinaryLittleEndian<point2D_t>(&stream, track_el.point2D_idx); |
| 471 | } |
| 472 | } |
| 473 | } |
| 474 | |
| 475 | void WritePoints3DBinary(const Reconstruction& reconstruction, |
| 476 | const std::filesystem::path& path) { |