2 * SPDX-FileCopyrightText: 2022 Jiri Vlasak
4 * SPDX-License-Identifier: GPL-3.0-only
14 RRTExt21::collide(RRTNode const &n)
16 int col = floor((n.x() - this->_origin_x) / this->_grid_res);
17 int row = floor((n.y() - this->_origin_y) / this->_grid_res);
18 if (col < 0 || row < 0 || col >= this->_grid_width
19 || row >= this->_grid_height) {
20 // grid is too small or sampling too far
23 if (this->_grid_data[row * this->_grid_width + col] > 65) {
30 RRTExt21::collide_steered()
33 for (auto &n: this->steered_) {
34 if (this->collide(n)) {
39 this->steered_.erase(this->steered_.begin() + i, this->steered_.end());
40 return this->steered_.size() == 0;
44 RRTExt21::set_grid_to_check(unsigned int w, unsigned int h, float r,
45 int8_t const *d, double x, double y)
47 this->_grid_width = w;
48 this->_grid_height = h;
55 } /* namespace rrts */