NavMap
|
Classes | |
struct | AABB |
Axis-aligned bounding box. More... | |
struct | BVHNode |
Node in a per-surface bounding volume hierarchy (BVH). More... | |
struct | Colors |
Optional per-vertex colors (RGBA, 8-bit per channel). More... | |
struct | LayerMeta |
Metadata associated to a layer (optional). More... | |
class | LayerRegistry |
Registry of named layers (per-NavCel). More... | |
struct | LayerView |
Typed layer view storing one T value per NavCel. More... | |
struct | LayerViewBase |
Non-templated base for runtime layer handling. More... | |
struct | NavCel |
Navigation cell (triangle) with geometry and adjacency. More... | |
class | NavMap |
Main container for navigable surfaces, geometry, and layers. More... | |
struct | Positions |
Structure-of-arrays for storing 3D vertex positions. More... | |
struct | Ray |
Simple ray (origin + direction). More... | |
struct | RayHit |
Result of a raycast against the NavMap. More... | |
struct | Surface |
A connected set of NavCels in a common reference frame. More... | |
Typedefs | |
using | NavCelId = uint32_t |
Index of a triangle (NavCel) within the global mesh. | |
using | PointId = uint32_t |
Index into the per-vertex position arrays (SoA). | |
using | Vec3 = Eigen::Vector3f |
3D vector alias used across NavMap geometry. | |
Enumerations | |
enum class | AreaShape { CIRCULAR , RECTANGULAR } |
Shape selector for area-writing APIs. More... | |
enum class | LayerType : uint8_t { U8 = 0 , F32 = 1 , F64 = 2 } |
Runtime type tag for a layer's scalar storage. More... | |
Functions | |
Vec3 | closest_point_on_triangle (const Vec3 &p, const Vec3 &a, const Vec3 &b, const Vec3 &c) |
Compute the closest point on triangle ABC to point P. | |
template<typename T> | |
constexpr LayerType | layer_type_tag () |
Helper to map C++ scalar type to navmap::LayerType tag. | |
template<> | |
constexpr LayerType | layer_type_tag< double > () |
template<> | |
constexpr LayerType | layer_type_tag< float > () |
template<> | |
constexpr LayerType | layer_type_tag< uint8_t > () |
float | point_triangle_squared_distance (const Vec3 &p, const Vec3 &a, const Vec3 &b, const Vec3 &c, Vec3 *closest=nullptr) |
Squared distance between point and triangle, with optional closest pt. | |
bool | ray_triangle_intersect (const Vec3 &orig, const Vec3 &dir, const Vec3 &v0, const Vec3 &v1, const Vec3 &v2, float &t, float &u, float &v) |
Möller–Trumbore ray–triangle intersection. | |
float | triangle_area (const Vec3 &a, const Vec3 &b, const Vec3 &c) |
Compute the area of a triangle ABC. | |
Vec3 | triangle_normal (const Vec3 &a, const Vec3 &b, const Vec3 &c) |
Compute a unit normal of triangle ABC. | |
using PointId = uint32_t |
Index into the per-vertex position arrays (SoA).
|
strong |
|
strong |
Compute the closest point on triangle ABC to point P.
Robustly handles all Voronoi regions (vertices/edges/interior). Degenerate triangles fall back to nearest vertex.
p | Query point. |
a | Triangle vertex A. |
b | Triangle vertex B. |
c | Triangle vertex C. |
p
.
|
constexpr |
Helper to map C++ scalar type to navmap::LayerType tag.
|
constexpr |
|
constexpr |
|
constexpr |
float point_triangle_squared_distance | ( | const Vec3 & | p, |
const Vec3 & | a, | ||
const Vec3 & | b, | ||
const Vec3 & | c, | ||
Vec3 * | closest = nullptr ) |
Squared distance between point and triangle, with optional closest pt.
p | Query point. |
a | Triangle vertex A. |
b | Triangle vertex B. |
c | Triangle vertex C. |
closest | Optional output: closest point on triangle to p . |
p
to triangle ABC.bool ray_triangle_intersect | ( | const Vec3 & | orig, |
const Vec3 & | dir, | ||
const Vec3 & | v0, | ||
const Vec3 & | v1, | ||
const Vec3 & | v2, | ||
float & | t, | ||
float & | u, | ||
float & | v ) |
Möller–Trumbore ray–triangle intersection.
Solves intersection between a ray (orig + t * dir, t > 0) and triangle (v0, v1, v2). Returns true
on hit and outputs:
t:
parametric distance along the ray (t > 0).u
, v:
barycentric coordinates (with w = 1 - u - v).orig | Ray origin. |
dir | Ray direction (not necessarily unit length). |
v0 | First triangle vertex. |
v1 | Second triangle vertex. |
v2 | Third triangle vertex. |
t | Output ray parameter on hit (> 0). |
u | Output barycentric u on hit. |
v | Output barycentric v on hit. |
kEps
is set conservatively for typical mapping units (meters). Compute the area of a triangle ABC.
a | First vertex (world coordinates). |
b | Second vertex (world coordinates). |
c | Third vertex (world coordinates). |
Compute a unit normal of triangle ABC.
The normal is computed as normalized cross product (b - a) x (c - a). If the triangle is degenerate (near-zero area), returns +Z (0, 0, 1).
a | First vertex (world coordinates). |
b | Second vertex (world coordinates). |
c | Third vertex (world coordinates). |