aboutsummaryrefslogtreecommitdiffstats
path: root/libtellurian_sea_level_radians.c
diff options
context:
space:
mode:
authorMattias Andrée <m@maandree.se>2024-10-19 18:21:54 +0200
committerMattias Andrée <m@maandree.se>2024-10-19 18:21:54 +0200
commit3ce34980d7ba2bddbf3e9a1bd6f98cbc855bddc2 (patch)
tree7724cc9cb9c3b2ce5ee60d2e012d1fbeb80aacfb /libtellurian_sea_level_radians.c
downloadlibtellurian-3ce34980d7ba2bddbf3e9a1bd6f98cbc855bddc2.tar.gz
libtellurian-3ce34980d7ba2bddbf3e9a1bd6f98cbc855bddc2.tar.bz2
libtellurian-3ce34980d7ba2bddbf3e9a1bd6f98cbc855bddc2.tar.xz
First commit
Signed-off-by: Mattias Andrée <m@maandree.se>
Diffstat (limited to '')
-rw-r--r--libtellurian_sea_level_radians.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/libtellurian_sea_level_radians.c b/libtellurian_sea_level_radians.c
new file mode 100644
index 0000000..a23b222
--- /dev/null
+++ b/libtellurian_sea_level_radians.c
@@ -0,0 +1,17 @@
+/* See LICENSE file for copyright and license details. */
+#include "common.h"
+
+
+double
+libtellurian_sea_level_radians(double latitude)
+{
+ double a = LIBTELLURIAN_EQUATORIAL_RADIUS;
+ double b = LIBTELLURIAN_POLAR_RADIUS;
+ double c = cos(latitude);
+ double s = sin(latitude);
+ double x = a * c * a;
+ double y = b * s * b;
+ double num = fma(x, x, y * y);
+ double denom = fma(x, c, y * s);
+ return sqrt(num / denom);
+}