function [x, y, z] = stoc(az,el,r)
% function ctos calculate x, y, and z from azimuth, elevation and distance
%  *              x       - x coordinate of image-model reflection
%  *              y       - y coordinate of image-model reflection
%  *              z       - z coordinate of image-model reflection
%  *              az      - azimuth incidence angles (degrees)
%  *              el      - elevation incidence angles (degrees)
%  *              r       - distance (m??)
% Translate from C code to matlab by Dennis Park 15.May.2014

    %need to make this values as Global
    DPR = 57.29578;             % degrees per radian conversion    */
    TINY = 1.0E-30;             % no zero dividing!                */

    z = sin ( el/DPR ) * r;
	hr = sqrt ( r*r - z*z );                % horizontal radius */
	x = cos ( (90 - az) /DPR ) * hr;
	y = sin ( (90 - az) /DPR ) * hr;
end