summaryrefslogtreecommitdiff
path: root/inst/geodetic2enu.m
diff options
context:
space:
mode:
Diffstat (limited to 'inst/geodetic2enu.m')
-rw-r--r--inst/geodetic2enu.m23
1 files changed, 10 insertions, 13 deletions
diff --git a/inst/geodetic2enu.m b/inst/geodetic2enu.m
index e591019..3d82082 100644
--- a/inst/geodetic2enu.m
+++ b/inst/geodetic2enu.m
@@ -1,6 +1,6 @@
-## Copyright (c) 2014-2020 Michael Hirsch, Ph.D.
-## Copyright (c) 2013-2020 Felipe Geremia Nievinski
-## Copyright (C) 2020 Philip Nienhuis
+## Copyright (c) 2014-2022 Michael Hirsch, Ph.D.
+## Copyright (c) 2013-2022 Felipe Geremia Nievinski
+## Copyright (C) 2020-2022 Philip Nienhuis
##
## Redistribution and use in source and binary forms, with or without
## modification, are permitted provided that the following conditions are met:
@@ -73,7 +73,7 @@
## u = 799.99
## @end example
##
-## @seealso {enu2geodetic, geodetic2aer, geodetic2ecef, geodetic2ned,
+## @seealso{enu2geodetic, geodetic2aer, geodetic2ecef, geodetic2ned,
## egm96geoid, referenceEllipsoid}
## @end deftypefn
@@ -124,13 +124,10 @@ function [e, n, u] = geodetic2enu (varargin)
error ("geodetic2enu: non-matching dimensions of ECEF inputs.");
endif
- if (isempty (spheroid))
- E = wgs84Ellipsoid;
- elseif (isstruct (spheroid))
- E = spheroid;
- else
- E = referenceEllipsoid (spheroid);
+ if (isnumeric (spheroid))
+ spheroid = num2str (spheroid);
endif
+ E = sph_chk (spheroid);
if (! ischar (angleUnit) || ! ismember (lower (angleUnit(1)), {"d", "r"}))
error ("geodetic2enu: angleUnit should be one of 'degrees' or 'radians'")
@@ -139,9 +136,9 @@ function [e, n, u] = geodetic2enu (varargin)
[x1, y1, z1] = geodetic2ecef (E, lat, lon, alt, angleUnit);
[x2, y2, z2] = geodetic2ecef (E, lat0, lon0, alt0, angleUnit);
- dx = x1 .- x2;
- dy = y1 .- y2;
- dz = z1 .- z2;
+ dx = x1 - x2;
+ dy = y1 - y2;
+ dz = z1 - z2;
[e, n, u] = ecef2enuv (dx, dy, dz, lat0, lon0, angleUnit);