function [a, f] = semimajorAxisAndFlattening(ellipsoid)
% Return semimajor axis a and flattening f from an "ellipsoid vector" of
% the form: [semimajor_axis, eccentricity]

% Copyright 2019-2020 The MathWorks, Inc.

%#codegen

    coder.ignoreCatch
    try %#ok<EMTC>
        validateattributes(ellipsoid, {'double'}, ...
            {'real', 'finite', 'nonnegative', 'size', [1 2]}, '', 'ELLIPSOID')
    catch e
        % Just in case ...
        throwAsCaller(e)
    end
    a  = ellipsoid(1);
    e2 = ellipsoid(2)^2;
    f = e2 / (1 + sqrt(1 - e2));
end
