Function navmap::triangle_normal

Function Documentation

inline Vec3 navmap::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:
  • a – First vertex (world coordinates).

  • b – Second vertex (world coordinates).

  • c – Third vertex (world coordinates).

Returns:

Unit-length normal or +Z fallback for degenerate triangles.