triangle_definition.m
来自「hodge decomposition for 2D vector fields」· M 代码 · 共 20 行
M
20 行
function triangles=triangle_definition(mv_x,mv_y)
%% generate the Grid Table, which defines the grid topology
%% mv_x: horizontal coordinates of the grids
%% mv_y: vertical coordinates of the grids
%% triangles: Nodes of all triangular meshes, i.e., the grid topology
[M,N]=size(mv_x);
period=(M-1);
total_tri=2*period*(N-1);
triangles=zeros(total_tri,3);
for i=1:N-1
for j=1:period
k=(i-1)*period+j;
start=floor((k-1)/period)*M+mod(k-1,period)+1;
triangles(2*k-1,:)=[start,start+M+1,start+M];
triangles(2*k,:)=[start,start+1,start+M+1];
end;
end;
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?