%getRhoHat Cartesian representation of that point 
%
%   Note: This is an internal undocumented function and its API and/or
%   functionality may change in subsequent releases.
%
%   TR 38.901 Section 7.1 Equation 7.1-6 and TR 36.873 Section 5.1.3 Equation
%   5.1.6. Cartesian representation of points on the unit sphere with zenith
%   angles 'theta' and azimuth angles 'phi'

%   Copyright 2020 The MathWorks, Inc.

%#codegen 
function out = getRhoHat(phi,theta)

    phi = permute(phi,[3 1 2]);
    theta = permute(theta,[3 1 2]);
    
    sintheta = sind(theta);
    x = sintheta.*cosd(phi);
    y = sintheta.*sind(phi);
    z = cosd(theta);
    out = [x; y; z];
    
end