www.pudn.com > calibr8.zip > dirangles.m


function [azimuths, elevations] = dirangles(directions)
%[azimuths, elevations] = DIRANGLES(directions)
%
%Convert directions to azimuth/elevation
%
%Input:
%  DIRECTIONS - directions vectors (array N x 3)
%
%Output:
%  AZIMUTHS   - azimuths of the directions in the interval <0, 360) degrees
%  ELEVATIONS - elevations of the directions in the interval <-90, 90> degrees
%
%See also:
%  DIR2ROT
%
%Radim Halir, Charles University Prague, halir@ms.mff.cuni.cz
%Created: 12.6.1997
%Last modified 12.6.1997

[azimuths, elevations] = cart2sph(directions(:, 1), directions(:, 2), ...
                         directions(:, 3));
azimuths = azimuths / pi * 180;
elevations = elevations / pi * 180;
ind = (azimuths < 0);
azimuths(ind) = azimuths(ind) + 360;