Go to the documentation of this file.
15 #ifndef BELUGA_SENSOR_DATA_DENSE_GRID_HPP
16 #define BELUGA_SENSOR_DATA_DENSE_GRID_HPP
82 template <
typename Derived>
90 [[nodiscard]]
bool contains(
int xi,
int yi)
const {
91 const auto width =
static_cast<int>(this->
self().width());
92 const auto height =
static_cast<int>(this->
self().height());
93 return xi >= 0 && yi >= 0 && xi < width && yi < height;
100 [[nodiscard]]
bool contains(
const Eigen::Vector2i& pi)
const {
return this->
self().
contains(pi.x(), pi.y()); }
108 [[nodiscard]]
auto data_at(
int xi,
int yi)
const {
109 return this->
self().
contains(xi, yi) ? this->
self().
data_at(this->
self().index_at(Eigen::Vector2i{xi, yi}))
118 [[nodiscard]]
auto data_at(
const Eigen::Vector2i& pi)
const {
return this->
self().
data_at(pi.x(), pi.y()); }
126 [[nodiscard]]
auto data_near(
double x,
double y)
const {
127 return this->
self().
data_at(this->
self().cell_near(Eigen::Vector2d{x, y}));
135 [[nodiscard]]
auto data_near(
const Eigen::Vector2d& p)
const {
return this->
self().
data_near(p.x(), p.y()); }
144 auto result = std::vector<Eigen::Vector2i>{};
145 if (xi <
static_cast<int>(this->
self().width() - 1)) {
146 result.emplace_back(xi + 1, yi);
148 if (yi <
static_cast<int>(this->
self().height() - 1)) {
149 result.emplace_back(xi, yi + 1);
152 result.emplace_back(xi - 1, yi);
155 result.emplace_back(xi, yi - 1);
bool contains(const Eigen::Vector2i &pi) const
Checks if a cell is included in the grid.
Regularly spaced N dimensional grid base type.
auto data_near(double x, double y) const
Gets nearest cell data, if included.
auto data_near(const Eigen::Vector2d &p) const
Gets nearest cell data, if included.
auto neighborhood4(const Eigen::Vector2i &pi) const
Computes 4-connected neighborhood for cell.
Concepts and abstract implementations of regular grids.
bool contains(int xi, int yi) const
Checks if a cell is included in the grid.
auto data_at(const Eigen::Vector2i &pi) const
Gets cell data, if included.
auto data_at(int xi, int yi) const
Gets cell data, if included.
auto neighborhood4(int xi, int yi) const
Computes 4-connected neighborhood for cell.
The main Beluga namespace.
beluga
Author(s):
autogenerated on Tue Jul 16 2024 02:59:53