⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 points2dnormalize.m

📁 meshless method programme for moving least square approximation
💻 M
字号:
function Po = points2dnormalize(Pi,mustRemove)
% POINTS2DNORMALIZE  Normalize 2d points
%
%  Normalize 2d points removing the last vector element.
%
%  Params:
%
%  Pi           = Input points
%  mustRemove   = Must the third column be removed? (def=true)
%
%  Po           = Output points

% Check args:
% Check number of arguments
if nargin<1
	error('Argument required for the points to be normalized');
end

% Check the removal switch
if nargin<2
    mustRemove = true;
end

% Check the input points matrix geometry
sizePi=size(Pi);
if sizePi(2)==0 Po=Pi;return; end
if sizePi(1)<2 | sizePi(1)>3
	error('Pi must be a n*2 or n*3 matrix');
end

% Check for normalization:
Po = Pi;
if not(sizePi(1)==2)
    % Normalization
    for i=1:sizePi(2)
        Po(:,i) = Po(:,i)/Po(3,i);
    end
end

% Returning
if mustRemove
    Po = Po(1:2,:);
elseif sizePi(1)==2
    Po = [Pi;ones(1,size(Pi,2))];
end

⌨️ 快捷键说明

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