Template Class Ray2d
Defined in File raycasting.hpp
Class Documentation
-
template<class OccupancyGrid, typename Algorithm = Bresenham2i>
class Ray2d Castable 2D ray.
- Template Parameters:
OccupancyGrid – A 2D occupancy grid
Algorithm – A callable type, taking start and end grid cells for a ray and returning the full trace.
Public Functions
-
inline explicit Ray2d(const OccupancyGrid &grid, const Sophus::SE2d &source_pose, double max_range) noexcept
Constructs 2D ray with default ray tracing algorithm.
See Ray2d(const OccupancyGrid &, Algorithm, const Sophus::SE2d&, double) for further reference on constructor arguments.
-
inline explicit Ray2d(const OccupancyGrid &grid, Algorithm algorithm, const Sophus::SE2d &source_pose, double max_range) noexcept
Constructs 2D ray with an specific ray tracing algorithm.
- Parameters:
grid – Grid on which to perform ray casting.
algorithm – Ray tracing algorithm implementation.
source_pose – Pose of the source of the ray in the same frame as that on which the
grid
origin is defined.max_range – Maximum range for the ray, in meters.
-
inline auto trace(const Sophus::SO2d &bearing) const
Computes ray trace along a given direction.
- Parameters:
bearing – Direction for ray tracing.
- Returns:
Full range of grid cells traced by the ray. That is, regardless of grid cells’ state.
-
inline std::optional<double> cast(const Sophus::SO2d &bearing) const
Casts ray along a given direction.
Distances are measured from cell centroid to cell centroid.
- Parameters:
bearing – Direction for ray casting.
- Returns:
Distance in meters to first non free cell hit by the ray, if any.