ethz-asl / voxblox

A library for flexible voxel-based mapping, mainly focusing on truncated and Euclidean signed distance fields.
BSD 3-Clause "New" or "Revised" License
1.37k stars 357 forks source link

code problem about raycasting #339

Open zhaozhongch opened 4 years ago

zhaozhongch commented 4 years ago

I am reading the code of voxblox. Part of code me confuses a lot. 1:in intergrator_utils.cc

  t_to_next_boundary_ = Ray((std::abs(ray_scaled.x()) < 0.0)
                                ? 2.0
                                : distance_to_boundaries.x() / ray_scaled.x(),
                            (std::abs(ray_scaled.y()) < 0.0)
                                ? 2.0
                                : distance_to_boundaries.y() / ray_scaled.y(),
                            (std::abs(ray_scaled.z()) < 0.0)
                                ? 2.0
                                : distance_to_boundaries.z() / ray_scaled.z());

It compares (std::abs(ray_scaled.x()) < 0.0 with 0? How could abs return a value smaller than zero?

2: in tsdf_integrate.ccMergedTsdfIntegrator::integratePointCloud

  integrateRays(T_G_C, points_C, colors, config_.enable_anti_grazing, false,
                voxel_map, clear_map);

  timing::Timer clear_timer("integrate/clear");

  integrateRays(T_G_C, points_C, colors, config_.enable_anti_grazing, true,
                voxel_map, clear_map);

There is a flag called is_clearing_ray turn from false to true so the ray is integrated twice. Why do we need to do twice integration here with a different condition? What will happen if I don't clear the rays?

zhaozhongch commented 4 years ago

About the second problem, I figure it out. The first integrateRays is for min_ray_length<points.norm()<max_ray_length The second integrateRays is for point.norm>max_ray_length If configure parameter allow_clear is set as true then voxel will be only integrated up to max_ray_length instead of point.norm()