NavMap
Loading...
Searching...
No Matches
Geometry.hpp File Reference

Low-level geometry utilities for NavMap cells (triangles), AABB and basic queries such as ray-triangle intersection and closest-point. More...

#include <Eigen/Core>
#include <Eigen/Geometry>
#include <limits>
#include <cmath>
#include <algorithm>
#include <array>
Include dependency graph for Geometry.hpp:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  AABB
 Axis-aligned bounding box. More...
 

Namespaces

namespace  navmap
 

Typedefs

using Vec3 = Eigen::Vector3f
 3D vector alias used across NavMap geometry.
 

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

Detailed Description

Low-level geometry utilities for NavMap cells (triangles), AABB and basic queries such as ray-triangle intersection and closest-point.

This header is intentionally lightweight and header-only to enable aggressive inlining by the compiler. It provides:

  • Basic triangle primitives (area, normal).
  • Robust Möller–Trumbore ray–triangle intersection.
  • AABB with robust ray-box intersection and XY containment helpers.
  • Closest point on triangle and point–triangle distance.