Skip to content
Snippets Groups Projects
Select Git revision
  • 90fad42931af21151e00d8eb30dcc84525ecacd0
  • master default protected
2 results

VecOrientation.m

Blame
  • Code owners
    Assign users and groups as approvers for specific file changes. Learn more.
    VecOrientation.m 328 B
    function [Phi,Theta] = VecOrientation(X,Y,Z)
    % VECORIENTATION Vector azimuth (phi) and elevation (theta)
    % [Phi,Theta] = VecOrientation(X,Y,Z)
    %
    % Patrick M. Jensen, 2018, ROCKWOOL
    
    FlipMask = 1 - 2*(Z < 0);
    X = FlipMask.*X;
    Y = FlipMask.*Y;
    Z = FlipMask.*Z;
    
    Phi = atan2(-Y, X);
    Theta = atan2(Z, sqrt(X.^2 + Y.^2));