Open FlukeAndFeather opened 2 years ago
I am not 100% sure on this one, so if you can double check my code to see if I implemented it correctly, that would be great. I think atan() just takes the overall sign of the y/z term to calculate the value, while atan2() considers the signs of each variable independently, which puts the result in the correct quadrant.
Use
atan2()
instead ofatan()
. The way you're usingatan()
can lead to a bug in one case (and may be why you're getting some NaNs). Look it up on Google (or whatever search tool you prefer) and put the reason in this thread.https://github.com/LilahMcC/NarwhalHR/blob/706112e60d29dd9f5ad5e564f8ea65b90017b799/util.R#L55