divide.m

来自「C++编译指导」· M 代码 · 共 29 行

M
29
字号
function  mesh = divide(mesh,t,p)
% DIVIDE divide triangle t into two triangels 
%
% USAGE
%   [mesh,eta] = divide(mesh,eta,t,p)
%
% INPUT
%   mesh:  current mesh
%    eta:  error indicator for each triangle
%      t:  triangle to be divided
%      p:  vertices of triangle t and new vertex
%            p(1),p(2),p(3) are vertices of t
%            p(4) new vertex which is opposite to p(1)
%
% OUTPUT
%   mesh:  new mesh

%

%--------------------------------------------------------------------------
% Add one element
%--------------------------------------------------------------------------
new = size(mesh.elem,1) + 1; % append new element to the end of elem array
mesh.elem(t,:)   = [p(4),p(1),p(2)]; % t is always a left child
mesh.elem(new,:) = [p(4),p(3),p(1)]; % new is a right child
% the newest vertex p(4) is the first vertex in each triangle
%--------------------------------------------------------------------------
% End of function DIVIDE
%--------------------------------------------------------------------------

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?