11 const std::array<std::array<float, 2>, 3>& pillar_map_range,
15 const int size_x = pillar_map_size[0];
16 const int size_y = pillar_map_size[1];
17 const int stride_val = stride > 0 ? stride : 1;
18 const int up_stride = first_up_stride > 0 ? first_up_stride : 1;
20 grid.
grid_x = size_x * up_stride / stride_val;
21 grid.
grid_y = size_y * up_stride / stride_val;
22 grid.
x_min = pillar_map_range[0][0];
23 grid.
x_max = pillar_map_range[0][1];
24 grid.
y_min = pillar_map_range[1][0];
25 grid.
y_max = pillar_map_range[1][1];
26 grid.
z_min = pillar_map_range[2][0];
27 grid.
z_max = pillar_map_range[2][1];
29 const float dx = (grid.
x_max - grid.
x_min) /
static_cast<float>(grid.
grid_x);
30 const float dy = (grid.
y_max - grid.
y_min) /
static_cast<float>(grid.
grid_y);
31 const float half_dx = dx * 0.5F;
32 const float half_dy = dy * 0.5F;
35 grid.
centers.resize(
static_cast<std::size_t
>(num_pillars) * 3);
37 std::size_t offset = 0;
38 for (
int ix = 0; ix < grid.
grid_x; ++ix) {
39 const float x_center = grid.
x_min + half_dx +
static_cast<float>(ix) * dx;
40 for (
int iy = 0; iy < grid.
grid_y; ++iy) {
41 const float y_center = grid.
y_min + half_dy +
static_cast<float>(iy) * dy;
42 grid.
centers[offset++] = x_center;
43 grid.
centers[offset++] = y_center;
PillarGrid BuildPillarGrid(const std::array< int, 2 > &pillar_map_size, const std::array< std::array< float, 2 >, 3 > &pillar_map_range, int first_up_stride, int stride)