# HG changeset patch
# User Mithil Leua
# Date 1490410567 -19800
# Sat Mar 25 08:26:07 2017 +0530
# Node ID 8d750a9c675b1d65a5eedde2abfde245abf12d0d
# Parent e3802bbf5c30e387407b8c7bbc4e9c69363eb9c6
added earthRadius function and few more tests for radtodeg
diff -r e3802bbf5c30 -r 8d750a9c675b inst/earthRadius.m
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/inst/earthRadius.m Sat Mar 25 08:26:07 2017 +0530
@@ -0,0 +1,30 @@
+## Copyright (C) 2017 Carnë Draug
+##
+## This program is free software; you can redistribute it and/or modify it under
+## the terms of the GNU General Public License as published by the Free Software
+## Foundation; either version 3 of the License, or (at your option) any later
+## version.
+##
+## This program is distributed in the hope that it will be useful, but WITHOUT
+## ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+## FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
+## details.
+##
+## You should have received a copy of the GNU General Public License along with
+## this program; if not, see .
+
+## -*- texinfo -*-
+## @deftypefn {Function File} {@var{km} =} earthRadius ()
+## Returns radius of the earth in km. (6371)
+## @end deftypefn
+
+## Author: Mithil Leua
+
+function R = earthRadius()
+ if (nargin != 0)
+ print_usage();
+ endif
+ R = 6371;
+endfunction
+
+%!assert (earthRadius(),6371)
diff -r e3802bbf5c30 -r 8d750a9c675b inst/earthRadius.m~
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/inst/earthRadius.m~ Sat Mar 25 08:26:07 2017 +0530
@@ -0,0 +1,30 @@
+## Copyright (C) 2017 Carnë Draug
+##
+## This program is free software; you can redistribute it and/or modify it under
+## the terms of the GNU General Public License as published by the Free Software
+## Foundation; either version 3 of the License, or (at your option) any later
+## version.
+##
+## This program is distributed in the hope that it will be useful, but WITHOUT
+## ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+## FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
+## details.
+##
+## You should have received a copy of the GNU General Public License along with
+## this program; if not, see .
+
+## -*- texinfo -*-
+## @deftypefn {Function File} {@var{km} =} earthRadius ()
+## Returns radius of the earth in km. (6371)
+## @end deftypefn
+
+## Author: Mithil Leua
+
+function R = earthRadius()
+ if (nargin != 0)
+ print_usage();
+ endif
+ R = 6371;
+endfunction
+
+%!assert (earthRadius(),6371)
diff -r e3802bbf5c30 -r 8d750a9c675b inst/radtodeg.m~
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/inst/radtodeg.m~ Sat Mar 25 08:26:07 2017 +0530
@@ -0,0 +1,34 @@
+## Copyright (C) 2014 Carnë Draug
+##
+## This program is free software; you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or (at
+## your option) any later version.
+##
+## This program is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with this program; see the file COPYING. If not, see
+## .
+
+## -*- texinfo -*-
+## @deftypefn {Function File} {} rad2deg (@var{anglin})
+## @deftypefnx {Function File} {} radtodeg (@var{anglin})
+## Converts angles input in radians to the equivalent in degrees.
+##
+## @seealso{deg2rad, unitsratio}
+## @end deftypefn
+
+function anglout = radtodeg (anglin)
+ ## This function only exists for Matlab compatibility, but really,
+ ## naming it rad2deg is much more standard (deg2km, ind2rgb, sub2ind)
+ anglout = (180*(anglin))/pi
+endfunction
+
+%!assert (radtodeg(pi),180,10*eps)
+%!assert (radtodeg(pi/3),60,100*eps)
+%!assert (radtodeg(0),0,100*eps)
+%!assert (radtodeg(pi/12),15,100*eps)