📄 mesh_edges.m
字号:
function edge = mesh_edges(FV)
% MESH_EDGES - Calculate edge length of triangulation
%
% edge = mesh_edges(FV)
%
% FV.vertices - vertices of mesh, Cartesian XYZ
% FV.faces - triangulation of vertices
%
% edge - connectivity of all vertices, indexed
% by vertex number
%
% $Revision: 1.2 $ $Date: 2003/03/02 03:20:44 $
%
% Licence: GNU GPL, no implied or express warranties
% History: 07/2002, Darren.Weber@flinders.edu.au
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
tic;
fprintf('...searching for mesh edges...');
nvertex = size(FV.vertices,1);
nface = size(FV.faces,1);
% the 'edge' matrix is the connectivity of all vertices
edge = zeros(nvertex);
for f = 1:nface,
% compute the length of all triangle edges (Diff is [3x3])
Diff = [FV.vertices(FV.faces(f,[1 2 3]),:) - FV.vertices(FV.faces(f,[2 3 1]),:)];
Norm = sqrt( sum(Diff.^2, 2) );
edge(FV.faces(f,1),FV.faces(f,2)) = Norm(1);
edge(FV.faces(f,2),FV.faces(f,3)) = Norm(2);
edge(FV.faces(f,3),FV.faces(f,1)) = Norm(3);
% make sure that all edges are symmetric
edge(FV.faces(f,2),FV.faces(f,1)) = Norm(1);
edge(FV.faces(f,3),FV.faces(f,2)) = Norm(2);
edge(FV.faces(f,1),FV.faces(f,3)) = Norm(3);
end
t=toc;
fprintf('done (%5.2f sec).\n',t);
return
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -