VN = vertexNormal(TR,vi)
VN = vertexNormal(TR)
IDs of vertices to query, specified as a column vector. Each
Vertex normals, returned a matrix. Each row,
If you do not specify
A row number of the matrix,
this ID to refer a specific vertex in the triangulation.
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