MCPcopy Create free account
hub / github.com/colmap/colmap / AssignPointsToBlocks

Function AssignPointsToBlocks

src/colmap/mvs/advancing_front_meshing.cc:575–605  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

573}
574
575std::vector<std::vector<size_t>> AssignPointsToBlocks(
576 const std::vector<colmap::PlyPoint>& points, const BlockGrid& grid) {
577 const Eigen::Vector3i grid_dims(grid.nx, grid.ny, grid.nz);
578 const double inv_block_size = 1.0 / grid.block_size;
579
580 std::vector<std::vector<size_t>> block_point_indices(grid.NumBlocks());
581 for (size_t i = 0; i < points.size(); ++i) {
582 const Eigen::Vector3d rel(points[i].x - grid.min.x(),
583 points[i].y - grid.min.y(),
584 points[i].z - grid.min.z());
585 const Eigen::Vector3i b_min =
586 ((rel.array() - grid.overlap) * inv_block_size)
587 .floor()
588 .cast<int>()
589 .max(0);
590 const Eigen::Vector3i b_max =
591 ((rel.array() + grid.overlap) * inv_block_size)
592 .floor()
593 .cast<int>()
594 .min(grid_dims.array() - 1);
595
596 for (int bx = b_min.x(); bx <= b_max.x(); ++bx) {
597 for (int by = b_min.y(); by <= b_max.y(); ++by) {
598 for (int bz = b_min.z(); bz <= b_max.z(); ++bz) {
599 block_point_indices[grid.BlockIndex(bx, by, bz)].push_back(i);
600 }
601 }
602 }
603 }
604 return block_point_indices;
605}
606
607std::vector<std::vector<size_t>> AssignRaysToBlocks(
608 const std::vector<K::Segment_3>& rays,

Callers 1

ReconstructBlocksFunction · 0.85

Calls 3

NumBlocksMethod · 0.80
sizeMethod · 0.80
BlockIndexMethod · 0.80

Tested by

no test coverage detected