function tag_str = ge_quiver3(XM,YM,ZM,UM,VM,WM,varargin)
error('%s has been deprecated',mfilename)
% Reference page in help browser:
%
% link to html documentation
% show license statement
%
AuthorizedOptions = authoptions( mfilename );
altitudeMode = 'absolute';
arrowScale = 1;
modelLinkStr = '[No model link specified]';
name = 'ge_quiver3';
timeStamp = ' ';
timeSpanStart = ' ';
timeSpanStop = ' ';
snippet = ' ';
description = '';
region = ' ';
fixedArrowLength = 0;
msgToScreen = false;
parsepairs %script that parses Parameter/Value pairs.
if msgToScreen
disp(['Running: ',mfilename,'...'])
end
if region == ' '
region_chars = '';
else
region_chars = [ region, 10 ];
end
if ~(isequal(altitudeMode,'clampToGround')||...
isequal(altitudeMode,'relativeToGround')||...
isequal(altitudeMode,'absolute'))
error(['Variable ',39,'altitudeMode',39, ' should be one of ' ,39,'clampToGround',39,', ',10,39,'relativeToGround',39,', or ',39,'absolute',39,'.' ])
end
if ~ismember(fixedArrowLength,[0,1])
error(['Function ',39,mfilename,39,': variable ',39,'fixedArrowLength',39,' may only be 0 or 1.'])
end
if timeStamp == ' '
timeStamp_chars = '';
else
timeStamp_chars = [ '' timeStamp '',10 ];
end
if timeSpanStart == ' '
timeSpan_chars = '';
else
if timeSpanStop == ' '
timeSpan_chars = [ '' timeSpanStart '',10 ];
else
timeSpan_chars = [ '' timeSpanStart '' timeSpanStop '',10 ];
end
end
if snippet == ' '
snippet_chars = '';
else
snippet_chars = [ '' snippet '',10 ];
end
description_chars = [ '',10,'',10,'',10 ];
tag_str = ['' 10,...
snippet_chars,...
description_chars,...
timeStamp_chars,...
timeSpan_chars,...
region_chars,...
'',name,'' 10,...
'' 10];
xv = XM(:);
yv = YM(:);
zv = ZM(:);
uv = UM(:);
vv = VM(:);
wv = WM(:);
av = sqrt(uv.^2+vv.^2+wv.^2);
clear XM YM ZM UM VM WM
heading = zeros(size(xv));
tilt = zeros(size(xv));
roll = zeros(size(xv));
for k=1:length(xv)
heading(k) = rad2deg(calc_dir(uv(k),vv(k)));
% tilt(k) = rad2deg(calc_dir(wv(k),sqrt(uv(k).^2 + vv(k).^2)));
tilt(k) = rad2deg(calc_dir(sqrt(uv(k).^2 + vv(k).^2),wv(k)))-90;
% if tilt(k)<-90||tilt(k)>90
% error(['Google Earth can do tilts from -90 (straight up) to 90 (straight down). ',10,...
% 'Current value is ' num2str(tilt(k)),'.'])
% end
tag_str = [tag_str,...
'', 10,...
'' altitudeMode '', 10,...
'', 10,...
' ' num2str(xv(k)) '', 10,...
' ' num2str(yv(k)) '', 10,...
' ' num2str(zv(k)) '', 10,...
'', 10,...
'', 10,...
' ' num2str(heading(k)) '', 10,...
' ' num2str(tilt(k)) '', 10,...
' ' num2str(roll(k)) '', 10,...
'', 10,...
'', 10'];
if fixedArrowLength==1
tag_str = [tag_str,...
' ',num2str(arrowScale),'', 10,...
' ',num2str(arrowScale),'', 10,...
' ',num2str(arrowScale),'', 10];
else
tag_str = [tag_str,...
' ',num2str(arrowScale*av(k)),'', 10,...
' ',num2str(arrowScale*av(k)),'', 10,...
' ',num2str(arrowScale*av(k)),'', 10];
end
tag_str = [tag_str,...
'', 10,...
'', 10,...
' ' modelLinkStr '', 10,...
'', 10,...
'', 10, 10, 10 ];
end
tag_str = [tag_str, 10,...
'' 10,...
'' 10];
if msgToScreen
disp(['Running: ',mfilename,'...Done'])
end
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
function a = calc_dir(U,V)
dy = V;
dx = U;
if (dy==0) && (dx==0)
a=0;
% error(['Unable to determine the direction of' 10 'a zero-length vector. Function: ' 39 mfilename 39 '.'])
elseif (dy==0)&&(dx>0)
a = 0.5*pi;
elseif (dy==0)&&(dx<0)
a = 1.5*pi;
elseif (dy>0)&&(dx==0)
a = 0;
elseif (dy<0)&&(dx==0)
a = pi;
elseif (dy>0)&&(dx>0)
a = mod(atan(dx/dy),2*pi);%#
elseif (dy>0)&&(dx<0)
a = mod(atan(dx/dy),2*pi);%#
elseif (dy<0)&&(dx>0)
a = mod(pi+atan(dx/dy),2*pi);%#
elseif (dy<0)&&(dx<0)
a = mod(pi+atan(dx/dy),2*pi);%#
else
a=NaN;%#
end
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
function d = rad2deg(r)
d = (r/(2*pi))*360;