Skip to content
Snippets Groups Projects
Commit 01586969 authored by Tom Fischer's avatar Tom Fischer
Browse files

[GL/Grid] Improve readability using Eigen::Vector3d.

parent 0728f615
No related branches found
No related tags found
No related merge requests found
...@@ -254,29 +254,21 @@ Grid<POINT>::getPntVecsOfGridCellsIntersectingCube(P const& center, ...@@ -254,29 +254,21 @@ Grid<POINT>::getPntVecsOfGridCellsIntersectingCube(P const& center,
double half_len) const double half_len) const
{ {
std::vector<std::vector<POINT*> const*> pnts; std::vector<std::vector<POINT*> const*> pnts;
POINT tmp_pnt{center[0] - half_len, center[1] - half_len, Eigen::Vector3d const c{center[0], center[1], center[2]};
center[2] - half_len}; // min std::array<std::size_t, 3> min_coords(getGridCoords(c.array() - half_len));
std::array<std::size_t, 3> min_coords(getGridCoords(tmp_pnt)); std::array<std::size_t, 3> max_coords(getGridCoords(c.array() + half_len));
tmp_pnt[0] = center[0] + half_len; std::size_t const steps0_x_steps1(_n_steps[0] * _n_steps[1]);
tmp_pnt[1] = center[1] + half_len; for (std::size_t c0 = min_coords[0]; c0 < max_coords[0] + 1; c0++)
tmp_pnt[2] = center[2] + half_len;
std::array<std::size_t, 3> max_coords(getGridCoords(tmp_pnt));
std::size_t coords[3], steps0_x_steps1(_n_steps[0] * _n_steps[1]);
for (coords[0] = min_coords[0]; coords[0] < max_coords[0] + 1; coords[0]++)
{ {
for (coords[1] = min_coords[1]; coords[1] < max_coords[1] + 1; for (std::size_t c1 = min_coords[1]; c1 < max_coords[1] + 1; c1++)
coords[1]++)
{ {
const std::size_t coords0_p_coords1_x_steps0( const std::size_t coords0_p_coords1_x_steps0(c0 + c1 * _n_steps[0]);
coords[0] + coords[1] * _n_steps[0]); for (std::size_t c2 = min_coords[2]; c2 < max_coords[2] + 1; c2++)
for (coords[2] = min_coords[2]; coords[2] < max_coords[2] + 1;
coords[2]++)
{ {
pnts.push_back( pnts.push_back(
&(_grid_cell_nodes_map[coords0_p_coords1_x_steps0 + &(_grid_cell_nodes_map[coords0_p_coords1_x_steps0 +
coords[2] * steps0_x_steps1])); c2 * steps0_x_steps1]));
} }
} }
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment