polyjoin.m

来自「麻省理工学院的人工智能工具箱,很珍贵,希望对大家有用!」· M 代码 · 共 39 行

M
39
字号
function [lat2,lon2] = polyjoin(latcells,loncells)
% POLYJOIN convert polygon segments from cell array to vector format
% 
% [lat2,lon2] = POLYJOIN(latcells,loncells) converts polygons from cell
% array format to vector format. In cell array format, each element of 
% the cell array is a separate polygon. Each polygon may consist of an 
% outer contour followed by holes separated with NaNs. In vector format, 
% each vector may contain multiple faces separated by NaNs. There is no
% distinction between outer contours and holes.
%
% See also POLYSPLIT, POLYBOOL, POLYCUT

%  Written by: W. Stumpf
%  Copyright 1996-2002 Systems Planning and Analysis, Inc. and The MathWorks, Inc.
%  $Revision: 1.4 $    $Date: 2002/03/20 21:26:08 $

if nargin<2, error('Incorrect number of input arguments.'), end

if ~iscell(latcells) | ~iscell(loncells)
	error('Inputs must be cell arrays.')
end

if isempty(latcells);

   [lat2,lon2] = deal([],[]);
   return
   
else
   
   [lat2,lon2] = deal(latcells{1},loncells{1});
   
end

for i=2:length(latcells)
   [lat2,lon2] = deal([lat2;NaN;latcells{i}], [lon2;NaN;loncells{i}]);
end


⌨️ 快捷键说明

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