# Documentation

### This is machine translation

Translated by
Mouseover text to see original. Click the button below to return to the English verison of the page.

Note: This page has been translated by MathWorks. Please click here
To view all translated materals including this page, select Japan from the country navigator on the bottom of this page.

# faceNormals

Class: TriRep

(Not recommended) Unit normals to specified triangles

### Note

`faceNormals(TriRep)` is not recommended. Use `faceNormal(triangulation)` instead.

`TriRep` is not recommended. 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; ```

## See Also

Was this topic helpful?

#### The Manager's Guide to Solving the Big Data Conundrum

Download white paper