Template Function beluga::nearest_obstacle_distance_map

Function Documentation

template<class Range, class DistanceFunction, class NeighborsFunction>
auto beluga::nearest_obstacle_distance_map(Range &&obstacle_mask, DistanceFunction &&distance_function, NeighborsFunction &&neighbors_function)

Returns a map where the value of each cell is the distance to the nearest obstacle.

The algorithm uses O(N) time and memory, where N=ranges::size(obstacle_map).

Template Parameters:
  • Range – A sized range. Its value type must be bool.

  • DistanceFunction – A callable type, its prototype must be (std::size_t, std::size_t) -> DistanceType. DistanceType must be an scalar type.

  • NeighborsFunction – A callabe type, its prototype must be (std::size_t) -> NeighborsT, where NeighborsT is a Range with value type std::size_t.

Parameters:
  • obstacle_mask – A mask that represents obstacles in an environment. If the value of a cell is True, the cell has an obstacle.

  • distance_function – Given the indexes of two cells in the map i and j, obstacle_map(i, j) must return the distance between the two cells.

  • neighbors_function – Given the index i of one cell in the map, neighbors_function(i) returns the cell indexes of neighbor cells in the obstacle map.

Returns:

A map where each cell value is the distance to the nearest object.