function [east,north,up] = pod2earth(u,v,w,tiltx,tilty,compass) % pod2earth -- rotate velocity from BASS to earth coordinates % % u,v,w are velocity in the Bass pod coordinates: % u from axes B, D % v from axes A, C % w is upward. % tiltx, tilty, and compass are angles in radians: % tiltx is between the u direction and horizontal % tilty is between the v direction and horizontal % compass is between the u direction and earth north. % east, north, up are the velocity components in earth % coordinates % Fran Hotchkiss, December 18, 1997 % Modified 25 June 1998 to use right-hand-rule definition of % tilt directions. If right hand thumb is in direction of % u velocity, a positive y-tilt is in the direction indicated % by the fingers. If right hand thumb is in direction of % v velocity, a positive x-tilt is in the direction indicated % by the fingers. FSH costx = cos(tiltx); sintx = sin(tiltx); costy = cos(tilty); sinty = sin(tilty); coscp = cos(compass); sincp = sin(compass); u2 = u .* costx + w .* sintx; v2 = v .* costy - w .* sinty; up = w .* costx .* costy - u .* sintx + v .* sinty; north = u2 .* coscp + v2 .* sincp; east = u2 .* sincp - v2 .* coscp;