本文整理汇总了C++中voxelgrid::VoxelGrid::GetOOBValue方法的典型用法代码示例。如果您正苦于以下问题:C++ VoxelGrid::GetOOBValue方法的具体用法?C++ VoxelGrid::GetOOBValue怎么用?C++ VoxelGrid::GetOOBValue使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类voxelgrid::VoxelGrid
的用法示例。
在下文中一共展示了VoxelGrid::GetOOBValue方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: make_pair
inline std::pair<double, bool> EstimateDistance(const Eigen::Vector3d& location) const
{
const std::vector<int64_t> indices = LocationToGridIndex(location);
if (indices.size() == 3)
{
const Eigen::Vector3d gradient = EigenHelpers::StdVectorDoubleToEigenVector3d(GetGradient(indices[0], indices[1], indices[2], true));
const std::vector<double> cell_location = GridIndexToLocation(indices[0], indices[1], indices[2]);
const Eigen::Vector3d cell_location_to_our_location(location.x() - cell_location[0], location.y() - cell_location[1], location.z() - cell_location[2]);
const double nominal_distance = (double)distance_field_.GetImmutable(indices[0], indices[1], indices[2]).first;
const double corrected_nominal_distance = (nominal_distance >= 0.0) ? nominal_distance - (GetResolution() * 0.5) : nominal_distance + (GetResolution() * 0.5);
const double cell_location_to_our_location_dot_gradient = cell_location_to_our_location.dot(gradient);
//const double gradient_dot_gradient = gradient.dot(gradient); // == squared norm of gradient
//const Eigen::Vector3d cell_location_to_our_location_projected_on_gradient = (cell_location_to_our_location_dot_gradient / gradient.dot(gradient)) * gradient;
//const double distance_adjustment = cell_location_to_our_location_projected_on_gradient.norm();
const double distance_adjustment = cell_location_to_our_location_dot_gradient / gradient.norm();
const double distance_estimate = corrected_nominal_distance + distance_adjustment;
if ((corrected_nominal_distance >= 0.0) == (distance_estimate >= 0.0))
{
return std::make_pair(distance_estimate, true);
}
else if (corrected_nominal_distance >= 0.0)
{
const double fudge_distance = GetResolution() * 0.0625;
return std::make_pair(fudge_distance, true);
}
else
{
const double fudge_distance = GetResolution() * -0.0625;
return std::make_pair(fudge_distance, true);
}
// else
// {
// const double real_distance_adjustment = GetResolution() * 0.20710678118654757;
// const double revised_corrected_nominal_distance = (nominal_distance >= 0.0) ? nominal_distance - real_distance_adjustment : nominal_distance + real_distance_adjustment;
// const double revised_distance_estimate = revised_corrected_nominal_distance + distance_adjustment;
// return std::make_pair(revised_distance_estimate, true);
// }
}
else
{
return std::make_pair((double)distance_field_.GetOOBValue(), false);
}
}