gaoxiang12 / faster-lio

Faster-LIO: Lightweight Tightly Coupled Lidar-inertial Odometry using Parallel Sparse Incremental Voxels
GNU General Public License v2.0
984 stars 259 forks source link

疑似BUG #58

Open Nothand0212 opened 11 months ago

Nothand0212 commented 11 months ago

eigen_types.h文件中,编译时下面这段代码有警告,我就进去看了一下

template <>
inline bool less_vec<3>::operator()( const Eigen::Matrix<int, 3, 1>& v1, const Eigen::Matrix<int, 3, 1>& v2 ) const
{
  return v1[ 0 ] < v2[ 0 ] || ( v1[ 0 ] == v2[ 0 ] && v1[ 1 ] < v2[ 1 ] ) && ( v1[ 0 ] == v2[ 0 ] && v1[ 1 ] == v2[ 1 ] && v1[ 2 ] < v2[ 2 ] );
}

按照前半段判断的逻辑推断,先比较两个向量的第1个元素,如果第1个元素相同,再对比第2个元素。按这种逻辑,后面应该是:如果第1和第2个元素都相同,则对比第3个元素吧? 是不是其实下面这样修改才是对的?

template <>
inline bool less_vec<3>::operator()( const Eigen::Matrix<int, 3, 1>& v1, const Eigen::Matrix<int, 3, 1>& v2 ) const
{
  return v1[ 0 ] < v2[ 0 ] || ( v1[ 0 ] == v2[ 0 ] && v1[ 1 ] < v2[ 1 ] ) || ( v1[ 0 ] == v2[ 0 ] && v1[ 1 ] == v2[ 1 ] && v1[ 2 ] < v2[ 2 ] );
}
Nothand0212 commented 11 months ago

还是说,如果第1个元素不符合,需要后面两个元素同时满足条件才为真?