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.

vertexNormal

Triangulation vertex normal

Syntax

```VN = vertexNormal(TR,vi) VN = vertexNormal(TR) ```

Description

`VN = vertexNormal(TR,vi)` returns the unit normal vector to each of the specified vertices in `vi`.

`VN = vertexNormal(TR)` returns the normal information for all vertices in the triangulation.

Input Arguments

 `TR` Triangulation representation, see `triangulation` or `delaunayTriangulation`. `vi` IDs of vertices to query, specified as a column vector. Each element in `vi` is a Vertex ID.

Output Arguments

 `VN` Vertex normals, returned a matrix. Each row, `VN(j,:)`, is the unit normal vector at the vertex `vi(j)`. The vector at `VN(j,:)` is the average unit normal of the faces attached to vertex `vi(j)`. If you do not specify `vi`, then `vertexNormal` returns the unit normal information for all vertices in the triangulation. In this case, the normal associated with `TR.Points(j,:)` is `VN(j,:)`.

Examples

expand all

Create a 3-D triangulation representing the volume of a cube.

```[X,Y,Z] = meshgrid(1:4); X = X(:); Y = Y(:); Z = Z(:); dt = delaunayTriangulation(X,Y,Z);```

Find the surfaces of the cube and isolate them in a 2-D triangulation.

```[Tfb,Xfb] = freeBoundary(dt); TR = triangulation(Tfb,Xfb);```

Find the unit normal vectors to the triangles on the surface of the cube.

`vn = vertexNormal(TR);`

Plot the results.

```trisurf(TR,'FaceColor', [0.8 0.8 1.0]); axis equal hold on quiver3(Xfb(:,1),Xfb(:,2),Xfb(:,3),... vn(:,1),vn(:,2),vn(:,3),0.5,'color','b'); hold off```

expand all