if ((diff2min <= displacement.array()).all() && (diff2max >= displacement.array()).all())
neighbors[ni] = leaf_layout_[((ijk + displacement - min_b_).dot(divb_mul_))]; // .at() can be omitted
else
neighbors[ni] = -1; // cell is out of bounds, consider it empty
}
return (neighbors);
}
/** \brief Return the minimum number of points required for a voxel to be used.
/** \brief Returns the layout of the leafs for fast access to cells relative to current position.
*/
* \note position at (i-min_x) + (j-min_y)*div_x + (k-min_z)*div_x*div_y holds the index of the element at coordinates (i,j,k) in the grid (-1 if empty)
/** \brief Get the minimum coordinates of the bounding box (after
/** \brief Get the field filter limits (min/max) set by the user. The default values are -std::numeric_limits<float>::max(), std::numeric_limits<float>::max().
* filtering is performed).
* \param[out] limit_min the minimum allowed field value
*/
* \param[out] limit_max the maximum allowed field value
if ((diff2min <= displacement.array()).all() && (diff2max >= displacement.array()).all())
neighbors[ni] = leaf_layout_[((ijk + displacement - min_b_).dot (divb_mul_))]; // .at() can be omitted
else
neighbors[ni] = -1; // cell is out of bounds, consider it empty
}
return (neighbors);
}
/** \brief Returns the layout of the leafs for fast access to cells relative to current position.
/** \brief Internal leaf sizes stored as 1/leaf_size_ for efficiency reasons. */
* \note position at (i-min_x) + (j-min_y)*div_x + (k-min_z)*div_x*div_y holds the index of the element at coordinates (i,j,k) in the grid (-1 if empty)
Eigen::Array4f inverse_leaf_size_;
*/
inline std::vector<int>
getLeafLayout () const { return (leaf_layout_); }
/** \brief Returns the corresponding (i,j,k) coordinates in the grid of point (x,y,z).
/** \brief The leaf layout information for fast access to cells relative to current position **/
* \param[in] x the X point coordinate to get the (i, j, k) index at
std::vector<int> leaf_layout_;
* \param[in] y the Y point coordinate to get the (i, j, k) index at
* \param[in] z the Z point coordinate to get the (i, j, k) index at
*/
inline Eigen::Vector3i
getGridCoordinates (float x, float y, float z) const
int idx = ((Eigen::Vector4i() << ijk, 0).finished() - min_b_).dot (divb_mul_);
if (idx < 0 || idx >= static_cast<int> (leaf_layout_.size ())) // this checks also if leaf_layout_.size () == 0 i.e. everything was computed as needed
{
//if (verbose)
// PCL_ERROR ("[pcl::%s::getCentroidIndexAt] Specified coordinate is outside grid bounds, or leaf layout is not saved, make sure to call setSaveLeafLayout(true) and filter(output) first!\n", getClassName ().c_str ());
return (-1);
}
return (leaf_layout_[idx]);
}
/** \brief Provide the name of the field to be used for filtering data. In conjunction with \a setFilterLimits,
/** \brief The minimum allowed filter value a point will be considered from. */
* points having values outside this interval will be discarded.
double filter_limit_min_;
* \param[in] field_name the name of the field that contains values used for filtering