RDI_Coords.pl
changeset 14 8c79b38a7086
parent 13 b176da8559b3
child 16 68a9fc5e7d45
equal deleted inserted replaced
13:b176da8559b3 14:8c79b38a7086
     1 #======================================================================
     1 #======================================================================
     2 #                    R D I _ C O O R D S . P L 
     2 #                    R D I _ C O O R D S . P L 
     3 #                    doc: Sun Jan 19 17:57:53 2003
     3 #                    doc: Sun Jan 19 17:57:53 2003
     4 #                    dlm: Wed Aug  7 11:18:51 2013
     4 #                    dlm: Wed Nov 27 11:21:49 2013
     5 #                    (c) 2003 A.M. Thurnherr
     5 #                    (c) 2003 A.M. Thurnherr
     6 #                    uE-Info: 199 23 NIL 0 0 72 0 2 4 NIL ofnI
     6 #                    uE-Info: 287 70 NIL 0 0 72 2 2 4 NIL ofnI
     7 #======================================================================
     7 #======================================================================
     8 
     8 
     9 # RDI Workhorse Coordinate Transformations
     9 # RDI Workhorse Coordinate Transformations
    10 
    10 
    11 # HISTORY:
    11 # HISTORY:
    31 #	Jan 22, 2011: - made velApplyHdgBias calculate sin/cos every time to allow
    31 #	Jan 22, 2011: - made velApplyHdgBias calculate sin/cos every time to allow
    32 #				    per-ensemble corrections
    32 #				    per-ensemble corrections
    33 #	Jan 15, 2012: - replaced defined(@...) by (@...) to get rid of warning
    33 #	Jan 15, 2012: - replaced defined(@...) by (@...) to get rid of warning
    34 #	Aug  7, 2013: - BUG: &velBeamToBPInstrument did not return any val unless
    34 #	Aug  7, 2013: - BUG: &velBeamToBPInstrument did not return any val unless
    35 #						 all beam velocities are defined
    35 #						 all beam velocities are defined
       
    36 #	Nov 27, 2013: - added &RDI_pitch(), &tilt_azimuth()
    36 
    37 
    37 use strict;
    38 use strict;
    38 use POSIX;
    39 use POSIX;
    39 
    40 
    40 my($PI) = 3.14159265358979;
    41 my($PI) = 3.14159265358979;
   272 {
   273 {
   273 	my($RDI_pitch,$RDI_roll) = @_;
   274 	my($RDI_pitch,$RDI_roll) = @_;
   274 	return deg(atan(tan(rad($RDI_pitch)) * cos(rad($RDI_roll))));
   275 	return deg(atan(tan(rad($RDI_pitch)) * cos(rad($RDI_roll))));
   275 }
   276 }
   276 
   277 
       
   278 sub RDI_pitch($$)
       
   279 {
       
   280 	my($gimbal_pitch,$roll) = @_;
       
   281 	return deg(atan(tan(rad($gimbal_pitch))/cos(rad($roll))));
       
   282 }
       
   283 
       
   284 sub tilt_azimuth($$)
       
   285 {
       
   286 	my($gimbal_pitch,$roll) = @_;
       
   287 	return angle(deg(atan2(sin(rad($gimbal_pitch)),sin(rad($roll)))));
       
   288 }
       
   289 
   277 # - angle from vertical is home grown and should be treated with caution
   290 # - angle from vertical is home grown and should be treated with caution
   278 # - angle between two unit vectors given by acos(v1 dot v2)
   291 # - angle between two unit vectors given by acos(v1 dot v2)
   279 # - vertical unit vector v1 = (0 0 1) => dot product = z-component of v2
   292 # - vertical unit vector v1 = (0 0 1) => dot product = z-component of v2
   280 # - when vertical unit vector is pitched in x direction, followed by
   293 # - when vertical unit vector is pitched in x direction, followed by
   281 #	roll in y direction:
   294 #	roll in y direction: