|
NavMap
|
Traversals over the NavCels of a navmap::NavMap: box, disc, ring, polygon, distance order and segment walk. More...
#include <algorithm>#include <array>#include <cmath>#include <cstddef>#include <cstdint>#include <functional>#include <limits>#include <type_traits>#include <utility>#include <vector>#include "Eigen/Core"#include "navmap_core/NavMap.hpp"

Go to the source code of this file.
Classes | |
| struct | TraversalScratch::Front |
| Dijkstra frontier entry: distance, NavCel, and the pivot it is measured from. More... | |
| class | TraversalScratch |
| Reusable traversal buffers. Not thread-safe: one per thread. More... | |
Namespaces | |
| namespace | navmap |
| namespace | navmap::detail |
Enumerations | |
| enum class | Metric { EUCLIDEAN , GEODESIC } |
| Distance from a centre used to grow a region. More... | |
Functions | |
| bool | boxes_overlap (const AABB &a, const AABB &b) |
| template<class F> | |
| std::size_t | for_each_by_distance (const NavMap &nm, NavCelId seed, const Eigen::Vector3f ¢er, float max_distance, F &&f, TraversalScratch *scratch=nullptr) |
Visits NavCels by geodesic distance from center, up to max_distance: a spiral over the surface (nearest free cell, local search...). | |
| template<class F> | |
| std::size_t | for_each_in_aabb (const NavMap &nm, const AABB &box, F &&f, TraversalScratch *scratch=nullptr) |
Visits the NavCels whose bounding box overlaps box, on every surface (via the BVH). | |
| template<class F> | |
| std::size_t | for_each_in_disc (const NavMap &nm, const Eigen::Vector3f ¢er, float radius, F &&f, Metric metric=Metric::EUCLIDEAN, TraversalScratch *scratch=nullptr) |
As above, locating the seed under center; visits nothing if the centre is off the map. | |
| template<class F> | |
| std::size_t | for_each_in_disc (const NavMap &nm, NavCelId seed, const Eigen::Vector3f ¢er, float radius, F &&f, Metric metric=Metric::EUCLIDEAN, TraversalScratch *scratch=nullptr) |
Visits the NavCels within radius of center, connected to seed (which should contain the centre). | |
| template<class F> | |
| std::size_t | for_each_in_polygon (const NavMap &nm, const Eigen::Vector3f &on_surface, const std::vector< Eigen::Vector2f > &poly, F &&f, TraversalScratch *scratch=nullptr) |
As above, locating the seed under on_surface (a point of the polygon's level). | |
| template<class F> | |
| std::size_t | for_each_in_polygon (const NavMap &nm, NavCelId seed, const std::vector< Eigen::Vector2f > &poly, F &&f, TraversalScratch *scratch=nullptr) |
Visits the NavCels whose centroid lies inside the XY polygon poly, connected to seed through NavCels inside it (so only the seed's level). | |
| template<class F> | |
| std::size_t | for_each_in_ring (const NavMap &nm, NavCelId seed, const Eigen::Vector3f ¢er, float r_in, float r_out, F &&f, Metric metric=Metric::EUCLIDEAN, TraversalScratch *scratch=nullptr) |
Visits the NavCels at distance in [r_in, r_out] from center, connected to seed through NavCels within r_out (the inner part is crossed, not visited). | |
| template<class F> | |
| bool | for_each_on_segment (const NavMap &nm, const Eigen::Vector3f &a, const Eigen::Vector3f &b, F &&f) |
As above, locating the seed under a; false if a is off the map. | |
| template<class F> | |
| bool | for_each_on_segment (const NavMap &nm, NavCelId seed, const Eigen::Vector3f &a, const Eigen::Vector3f &b, F &&f) |
Walks the surface along segment a -> b (in XY), from seed (the NavCel under a), visiting each NavCel crossed with the segment parameters where it enters and leaves. | |
| template<class F> | |
| bool | for_each_on_segment_impl (const NavMap &nm, NavCelId seed, const Eigen::Vector3f &a, const Eigen::Vector3f &b, F &&f) |
| template<class F> | |
| std::size_t | grow (const NavMap &nm, NavCelId seed, const Eigen::Vector3f ¢er, float r_in, float r_out, Metric metric, bool with_seed, TraversalScratch *scratch, F &f) |
| bool | in_polygon (const std::vector< Eigen::Vector2f > &poly, float x, float y) |
| AABB | navcel_box (const NavMap &nm, NavCelId cid) |
| bool | seed_at (const NavMap &nm, const Eigen::Vector3f &p, NavCelId &seed) |
| template<class F, class ... A> | |
| bool | visit (F &f, A &&... a) |
Variables | |
| constexpr NavCelId | kNoCel = std::numeric_limits<NavCelId>::max() |
Traversals over the NavCels of a navmap::NavMap: box, disc, ring, polygon, distance order and segment walk.
Every traversal calls a visitor per NavCel. The visitor may return void, or bool: false stops the traversal. Regions around a point (disc, ring, polygon, distance order) grow from a seed NavCel through the mesh adjacency, so they stay on the seed's surface and level: a disc on the ground floor never reaches the floor above, however close it is in XY. The box traversal is global (every surface). A NavCel belongs to a region when its centroid does.
Pass a TraversalScratch to reuse buffers across calls: once warm, no traversal allocates.