Documentation / @ripl/3d / computeFaceNormal
Function: computeFaceNormal() ​
computeFaceNormal(
vertices):Vector3
Defined in: 3d/src/core/shading.ts:55
Computes the surface normal of a face from its first three vertices via the cross product.
Delegates to vec3TriangleNormal so the CPU painter and the GPU mesh path agree on degenerate faces — the two used to disagree, one shading a collapsed face black and the other treating it as facing up.
Parameters ​
| Parameter | Type | Description |
|---|---|---|
vertices | Vector3[] | The face's vertices; only the first three are read. |
Returns ​
The face's unit normal.