Skip to content

Documentation / @ripl/3d / vec3TriangleNormal

Function: vec3TriangleNormal() ​

vec3TriangleNormal(a, b, c): Vector3

Defined in: 3d/src/math/vector.ts:65

Returns the unit-length normal of the triangle a → b → c, wound counter-clockwise.

A degenerate triangle — zero area, so no defined facing — yields the up vector rather than vec3Normalize's zero vector, so a collapsed face still shades instead of going black.

Parameters ​

ParameterTypeDescription
aVector3The triangle's first vertex.
bVector3The triangle's second vertex.
cVector3The triangle's third vertex.

Returns ​

Vector3

The triangle's unit normal.