NavMap
Loading...
Searching...
No Matches
navmap Namespace Reference

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.
 

Typedef Documentation

◆ NavCelId

using NavCelId = uint32_t

Index of a triangle (NavCel) within the global mesh.

◆ PointId

using PointId = uint32_t

Index into the per-vertex position arrays (SoA).

◆ Vec3

using Vec3 = Eigen::Vector3f

3D vector alias used across NavMap geometry.

Enumeration Type Documentation

◆ AreaShape

enum class AreaShape
strong

Shape selector for area-writing APIs.

Enumerator
CIRCULAR 
RECTANGULAR 

◆ LayerType

enum class LayerType : uint8_t
strong

Runtime type tag for a layer's scalar storage.

The registry currently supports: 8-bit unsigned, 32-bit float, 64-bit double.

Enumerator
U8 
F32 
F64 

Function Documentation

◆ closest_point_on_triangle()

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.

Robustly handles all Voronoi regions (vertices/edges/interior). Degenerate triangles fall back to nearest vertex.

Parameters
pQuery point.
aTriangle vertex A.
bTriangle vertex B.
cTriangle vertex C.
Returns
Closest point on triangle to p.

◆ layer_type_tag()

template<typename T>
LayerType layer_type_tag ( )
constexpr

Helper to map C++ scalar type to navmap::LayerType tag.

◆ layer_type_tag< double >()

template<>
LayerType layer_type_tag< double > ( )
constexpr

◆ layer_type_tag< float >()

template<>
LayerType layer_type_tag< float > ( )
constexpr

◆ layer_type_tag< uint8_t >()

template<>
LayerType layer_type_tag< uint8_t > ( )
constexpr

◆ point_triangle_squared_distance()

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.

Parameters
pQuery point.
aTriangle vertex A.
bTriangle vertex B.
cTriangle vertex C.
closestOptional output: closest point on triangle to p.
Returns
Squared Euclidean distance from p to triangle ABC.
Note
Squared distance avoids an extra sqrt and is preferred when comparing distances or using as thresholds.

◆ ray_triangle_intersect()

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).
Parameters
origRay origin.
dirRay direction (not necessarily unit length).
v0First triangle vertex.
v1Second triangle vertex.
v2Third triangle vertex.
tOutput ray parameter on hit (> 0).
uOutput barycentric u on hit.
vOutput barycentric v on hit.
Returns
True if the ray intersects the triangle with t > 0.
Warning
Numerical robustness depends on the geometry scale; kEps is set conservatively for typical mapping units (meters).

◆ triangle_area()

float triangle_area ( const Vec3 & a,
const Vec3 & b,
const Vec3 & c )

Compute the area of a triangle ABC.

Parameters
aFirst vertex (world coordinates).
bSecond vertex (world coordinates).
cThird vertex (world coordinates).
Returns
Triangle area (non-negative).
Note
Uses 0.5 * |(b - a) x (c - a)|.

◆ triangle_normal()

Vec3 triangle_normal ( const Vec3 & a,
const Vec3 & b,
const Vec3 & c )

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).

Parameters
aFirst vertex (world coordinates).
bSecond vertex (world coordinates).
cThird vertex (world coordinates).
Returns
Unit-length normal or +Z fallback for degenerate triangles.