equal
deleted
inserted
replaced
1 #====================================================================== |
1 #====================================================================== |
2 # L I B V E C . P L |
2 # L I B V E C . P L |
3 # doc: Sat Mar 20 12:50:32 1999 |
3 # doc: Sat Mar 20 12:50:32 1999 |
4 # dlm: Thu May 24 21:51:20 2018 |
4 # dlm: Mon Mar 1 08:46:35 2021 |
5 # (c) 1999 A.M. Thurnherr |
5 # (c) 1999 A.M. Thurnherr |
6 # uE-Info: 170 0 NIL 0 0 70 2 2 4 NIL ofnI |
6 # uE-Info: 45 70 NIL 0 0 70 2 2 4 NIL ofnI |
7 #====================================================================== |
7 #====================================================================== |
8 |
8 |
9 # HISTORY: |
9 # HISTORY: |
10 # Mar 20, 1999: - created for ANTS_2.1 (no more c-code) |
10 # Mar 20, 1999: - created for ANTS_2.1 (no more c-code) |
11 # May 27, 1999: - added polar/cartesian conversions |
11 # May 27, 1999: - added polar/cartesian conversions |
40 # (previous version only used for 2014 CLIVAR P06 |
40 # (previous version only used for 2014 CLIVAR P06 |
41 # processing with IMP data with confused coord |
41 # processing with IMP data with confused coord |
42 # system) |
42 # system) |
43 # Aug 7, 2016: - made vel_u and vel_v deal with nans |
43 # Aug 7, 2016: - made vel_u and vel_v deal with nans |
44 # Nov 15, 2017: - re-enabled usage-message (of sorts) for vel_u only |
44 # Nov 15, 2017: - re-enabled usage-message (of sorts) for vel_u only |
|
45 # Mar 1, 2021: - adapted rotation_ts and angle_ts to deal with nans |
45 |
46 |
46 require "$ANTS/libPOSIX.pl"; # acos() |
47 require "$ANTS/libPOSIX.pl"; # acos() |
47 |
48 |
48 #---------------------------------------------------------------------- |
49 #---------------------------------------------------------------------- |
49 # &rad() calc radians |
50 # &rad() calc radians |
208 |
209 |
209 { my($last_in); |
210 { my($last_in); |
210 |
211 |
211 sub rotation_ts(@) |
212 sub rotation_ts(@) |
212 { |
213 { |
213 my($a) = &antsFunUsage(1,"f","<angle>",@_); |
214 my($a) = &antsFunUsage(1,".","<angle>",@_); |
|
215 return nan unless numberp($a); |
214 |
216 |
215 my($rot) = defined($last_in) ? angle_diff($a,$last_in) : nan; |
217 my($rot) = defined($last_in) ? angle_diff($a,$last_in) : nan; |
216 $last_in = $a; |
218 $last_in = $a; |
217 return $rot; |
219 return $rot; |
218 } |
220 } |
220 |
222 |
221 { my($last_in,$last_out); |
223 { my($last_in,$last_out); |
222 |
224 |
223 sub angle_ts(@) |
225 sub angle_ts(@) |
224 { |
226 { |
225 my($a) = &antsFunUsage(1,"f","<angle>",@_); |
227 my($a) = &antsFunUsage(1,".","<angle>",@_); |
|
228 return nan unless numberp($a); |
226 |
229 |
227 $last_out = $last_in = $a |
230 $last_out = $last_in = $a |
228 unless (defined($last_in)); |
231 unless (defined($last_in)); |
229 |
232 |
230 $last_out += angle_diff($a,$last_in); |
233 $last_out += angle_diff($a,$last_in); |