13 using Tmap = std::vector<signed char>;
32 return Dim == 2 ? pn(0) +
dim_(0) * pn(1) :
47 for(
int i = 0; i < Dim; i++)
48 if (pn(i) < 0 || pn(i) >=
dim_(i))
91 std::cout <<
"MapUtil Info ========================== " << std::endl;
92 std::cout <<
" res: [" <<
res_ <<
"]" << std::endl;
93 std::cout <<
" origin: [" <<
origin_d_.transpose() <<
"]" << std::endl;
94 std::cout <<
" range: [" << range.transpose() <<
"]" << std::endl;
95 std::cout <<
" dim: [" <<
dim_.transpose() <<
"]" << std::endl;
101 for(
int i = 0; i < Dim; i++)
115 int max_diff = (diff /
res_).
template lpNorm<Eigen::Infinity>() / k;
121 for (
int n = 1; n < max_diff; n++) {
126 if (new_pn != prev_pn)
127 pns.push_back(new_pn);
136 for (
const auto &pn : pns) {
148 for (n(0) = 0; n(0) <
dim_(0); n(0)++) {
149 for (n(1) = 0; n(1) <
dim_(1); n(1)++) {
150 for (n(2) = 0; n(2) <
dim_(2); n(2)++) {
158 for (n(0) = 0; n(0) <
dim_(0); n(0)++) {
159 for (n(1) = 0; n(1) <
dim_(1); n(1)++) {
174 for (n(0) = 0; n(0) <
dim_(0); n(0)++) {
175 for (n(1) = 0; n(1) <
dim_(1); n(1)++) {
176 for (n(2) = 0; n(2) <
dim_(2); n(2)++) {
184 for (n(0) = 0; n(0) <
dim_(0); n(0)++) {
185 for (n(1) = 0; n(1) <
dim_(1); n(1)++) {
200 for (n(0) = 0; n(0) <
dim_(0); n(0)++) {
201 for (n(1) = 0; n(1) <
dim_(1); n(1)++) {
202 for (n(2) = 0; n(2) <
dim_(2); n(2)++) {
210 for (n(0) = 0; n(0) <
dim_(0); n(0)++) {
211 for (n(1) = 0; n(1) <
dim_(1); n(1)++) {
226 for (n(0) = 0; n(0) <
dim_(0); n(0)++) {
227 for (n(1) = 0; n(1) <
dim_(1); n(1)++) {
228 for (n(2) = 0; n(2) <
dim_(2); n(2)++) {
230 for (
const auto &it : dilate_neighbor) {
240 for (n(0) = 0; n(0) <
dim_(0); n(0)++) {
241 for (n(1) = 0; n(1) <
dim_(1); n(1)++) {
243 for (
const auto &it : dilate_neighbor) {
259 for (n(0) = 0; n(0) <
dim_(0); n(0)++) {
260 for (n(1) = 0; n(1) <
dim_(1); n(1)++) {
261 for (n(2) = 0; n(2) <
dim_(2); n(2)++) {
269 for (n(0) = 0; n(0) <
dim_(0); n(0)++) {
270 for (n(1) = 0; n(1) <
dim_(1); n(1)++) {
vec_Vecf< Dim > getFreeCloud()
Get free voxels.
Definition: map_util.h:170
void dilate(const vec_Veci< Dim > &dilate_neighbor)
Dilate occupied cells.
Definition: map_util.h:222
Definition: map_util.h:11
MapUtil()
Simple constructor.
Definition: map_util.h:21
bool isOccupied(const Veci< Dim > &pn)
Check if the given cell is occupied by coordinate.
Definition: map_util.h:60
int8_t val_unknown
Assume unknown cell has value -1.
Definition: map_util.h:292
Vecf< Dim > origin_d_
Origin, float type.
Definition: map_util.h:284
Definition: map_util.h:18
bool isOutside(const Veci< Dim > &pn)
Check if the cell is outside by coordinate.
Definition: map_util.h:46
std::vector< signed char > Tmap
The type of map data Tmap is defined as a 1D array.
Definition: map_util.h:13
void info()
Print basic information about the util.
Definition: map_util.h:89
decimal_t getRes()
Get resolution.
Definition: map_util.h:25
Veci< Dim > floatToInt(const Vecf< Dim > &pt)
Float position to discrete cell coordinate.
Definition: map_util.h:99
vec_E< Vecf< N > > vec_Vecf
Vector of Eigen 1D float vector.
Definition: data_type.h:69
Vecf< Dim > intToFloat(const Veci< Dim > &pn)
Discrete cell coordinate to float position.
Definition: map_util.h:106
int8_t val_free
Assume free cell has value 0.
Definition: map_util.h:290
Vecf< Dim > getOrigin()
Get origin.
Definition: map_util.h:29
Eigen::Matrix< int, N, 1 > Veci
Eigen 1D int vector of size N.
Definition: data_type.h:58
double decimal_t
Rename the float type used in lib.
Definition: data_type.h:48
int getIndex(const Veci< Dim > &pn)
Get index of a cell.
Definition: map_util.h:31
bool isUnknown(int idx)
Check if the cell is unknown by index.
Definition: map_util.h:41
bool isFree(const Veci< Dim > &pn)
Check if the given cell is free by coordinate.
Definition: map_util.h:53
vec_Vecf< Dim > getCloud()
Get occupied voxels.
Definition: map_util.h:144
vec_E< Veci< N > > vec_Veci
Vector of Eigen 1D int vector.
Definition: data_type.h:72
bool isOccupied(int idx)
Check if the cell is occupied by index.
Definition: map_util.h:43
decimal_t res_
Resolution.
Definition: map_util.h:282
Defines all data types used in this lib.
Tmap map_
Map entity.
Definition: map_util.h:279
Tmap getMap()
Get map data.
Definition: map_util.h:23
void freeUnknown()
Free unknown voxels.
Definition: map_util.h:256
bool isBlocked(const Vecf< Dim > &p1, const Vecf< Dim > &p2, int8_t val=100)
Check if the ray from p1 to p2 is occluded.
Definition: map_util.h:134
Eigen::Matrix< decimal_t, N, 1 > Vecf
Eigen 1D float vector of size N.
Definition: data_type.h:55
Veci< Dim > dim_
Dimension, int type.
Definition: map_util.h:286
vec_Veci< Dim > rayTrace(const Vecf< Dim > &pt1, const Vecf< Dim > &pt2)
Raytrace from float point pt1 to pt2.
Definition: map_util.h:112
int8_t val_occ
Assume occupied cell has value 100.
Definition: map_util.h:288
bool isOutsideXYZ(const Veci< Dim > &n, int i)
Check if the given cell is outside of the map in i-the dimension.
Definition: map_util.h:37
vec_Vecf< Dim > getUnknownCloud()
Get unknown voxels.
Definition: map_util.h:196
bool isFree(int idx)
Check if the cell is free by index.
Definition: map_util.h:39
Veci< Dim > getDim()
Get dimensions.
Definition: map_util.h:27
void setMap(const Vecf< Dim > &ori, const Veci< Dim > &dim, const Tmap &map, decimal_t res)
Set map.
Definition: map_util.h:81
bool isUnknown(const Veci< Dim > &pn)
Check if the given cell is unknown by coordinate.
Definition: map_util.h:67