# faceNormals

Class: TriRep

(Will be removed) Unit normals to specified triangles

 Note:   `faceNormals(TriRep)` will be removed in a future release. Use `faceNormal(triangulation)` instead.`TriRep` will be removed in a future release. Use `triangulation` instead.

## Syntax

`FN = faceNormals(TR, TI)`

## Description

`FN = faceNormals(TR, TI)` returns the unit normal vector to each of the specified triangles TI.

 Note:   This query is only applicable to triangular surface meshes.

## Input Arguments

 `TR` Triangulation representation. `TI` Column vector of indices that index into the triangulation matrix `TR.Triangulation`.

## Output Arguments

 `FN` `m`-by-3 matrix. `m = length(TI)`, the number of triangles to be queried. Each row `FN(i,:)` represents the unit normal vector to triangle `TI(i)`. If TI is not specified the unit normal information for the entire triangulation is returned, where the normal associated with triangle i is the `i`'th row of `FN`.

## Examples

Triangulate a sample of random points on the surface of a sphere and use the `TriRep` to compute the normal to each triangle:

```numpts = 100; thetha = rand(numpts,1)*2*pi; phi = rand(numpts,1)*pi; x = cos(thetha).*sin(phi); y = sin(thetha).*sin(phi); z = cos(phi); dt = DelaunayTri(x,y,z); [tri Xb] = freeBoundary(dt); tr = TriRep(tri, Xb); P = incenters(tr); fn = faceNormals(tr); trisurf(tri,Xb(:,1),Xb(:,2),Xb(:,3), ... 'FaceColor', 'cyan', 'faceAlpha', 0.8); axis equal; hold on; ```

Display the result using a quiver plot:

```quiver3(P(:,1),P(:,2),P(:,3), ... fn(:,1),fn(:,2),fn(:,3),0.5, 'color','r'); hold off; ```