Solving normal vectors that are not of unit length
Show older comments
I have generated a triangulate mesh in Matlab through the triangulation and the trisurf function. I am trying to calculate the facenormal vectors from the centre of each triangulated mesh since that will provide me with the area of each mesh which i require. I have tried to produce 2 vectors from one point index to the other and cross multiplied them to get the normal vector however it does not seem to give me an accurate representation of the magnitude of the area of each mesh.
% % FINDING AREA OF TRIANGLES %%%%%%%%%FOR MAIN BODY%%%%%%%%%%
% % Defining the X Y Z coordinate
Vt1=k11(:,1); %first point index Vt2=k11(:,2); %second Vt3=k11(:,3); %third
% Vector 1
for i = 1:length(Q11) %Q11 is number of nodes in the mesh
Vt4(i,:)=colibri15(Vt1(i),:);
Vt5(i,:)=colibri15(Vt2(i),:);
end
d12=[Vt5(:,1)-Vt4(:,1) Vt5(:,2)-Vt4(:,2) Vt5(:,3)-Vt4(:,3)];
% Vector 2
for i = 1:length(Q11)
Vt6(i,:)=colibri15(Vt1(i),:);
Vt7(i,:)=colibri15(Vt3(i),:);
end
d13=[Vt7(:,1)-Vt6(:,1) Vt7(:,2)-Vt6(:,2) Vt7(:,3)-Vt6(:,3)];
colibri15 is the body that i generated the mesh around and stores the coordinates of the nodes.
Answers (1)
Steven Lord
on 9 Mar 2018
0 votes
If you're using a triangulation object, consider using the faceNormal function on your triangulation.
1 Comment
Huzaifa Iftikhar
on 9 Mar 2018
Categories
Find more on Triangulations in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!