int usage(int retval, bool brief) {
  if (brief)
    ( retval ? std::cerr : std::cout ) << "Usage:\n"
"    Geod3Solve [ -i | -L bet1 omg1 alp1 ] [ -t a b c | -e b e2 k2 kp2 | -e2\n"
"    b f ] [ -u ] [ -d | -: ] [ -w ] [ -f ] [ -p prec ] [\n"
"    --comment-delimiter commentdelim ] [ --version | -h | --help ] [\n"
"    --input-file infile | --input-string instring ] [ --line-separator\n"
"    linesep ] [ --output-file outfile ]\n"
"\n"
"For full documentation type:\n"
"    Geod3Solve --help\n"
"or visit:\n"
"    https://geographiclib.sourceforge.io/C++/2.7/Geod3Solve.1.html\n";
  else
    ( retval ? std::cerr : std::cout ) << "Man page:\n"
"\n"
"SYNOPSIS\n"
"       Geod3Solve [ -i | -L bet1 omg1 alp1 ] [ -t a b c | -e b e2 k2 kp2 | -e2\n"
"       b f ] [ -u ] [ -d | -: ] [ -w ] [ -f ] [ -p prec ] [\n"
"       --comment-delimiter commentdelim ] [ --version | -h | --help ] [\n"
"       --input-file infile | --input-string instring ] [ --line-separator\n"
"       linesep ] [ --output-file outfile ]\n"
"\n"
"DESCRIPTION\n"
"       The shortest path between two points on a triaxial ellipsoid at (bet1,\n"
"       omg1) and (bet2, omg2) is called the geodesic.  Its length is s12 and\n"
"       the geodesic from point 1 to point 2 has forward azimuths alp1 and alp2\n"
"       at the two end points.  Here bet and omg denote the ellipsoidal\n"
"       latitude, beta, and longitude, omega; alp is an abbreviation of alpha\n"
"\n"
"       Geod3Solve operates in one of three modes:\n"
"\n"
"       1.  By default, Geod3Solve accepts lines on the standard input\n"
"           containing bet1 omg1 alp1 s12 and prints bet2 omg2 alp2 on standard\n"
"           output.  This is the direct geodesic calculation.\n"
"\n"
"       2.  With the -i option, Geod3Solve performs the inverse geodesic\n"
"           calculation.  It reads lines containing bet1 omg1 bet2 omg2 and\n"
"           prints the corresponding values of alp1 alp2 s12.\n"
"\n"
"       3.  Command line arguments -L bet1 omg1 alp1 specify a geodesic line.\n"
"           Geod3Solve then accepts a sequence of s12 values (one per line) on\n"
"           standard input and prints bet2 omg2 alp2 for each.  This generates\n"
"           a sequence of points on a single geodesic.\n"
"\n"
"OPTIONS\n"
"       -i  perform an inverse geodesic calculation (see 2 above).\n"
"\n"
"       -L bet1 omg1 alp1\n"
"           line mode (see 3 above); generate a sequence of points along the\n"
"           geodesic specified by bet1 omg1 alp1.  The -w flag can be used to\n"
"           swap the default order of the 2 geographic coordinates, provided\n"
"           that it appears before -L.\n"
"\n"
"       -t a b c\n"
"           specify the ellipsoid via its major semiaxis a, median semiaxis b,\n"
"           and minor semixis c.  By default, we have a = 6378172 m, b =\n"
"           6378102 m, c = 6356752 m, an approximate triaxial model of the\n"
"           earth.  (With this model omg = 0deg, corresponds to lon =\n"
"           -14.93deg.\n"
"\n"
"       -e b e2 k2 kp2\n"
"           specify the ellipsoid via the median semiaxis, b and the shape\n"
"           parameters e2 = (a^2 - c^2)/b^2, k2 = (b^2 - c^2)/(a^2 - c^2), and\n"
"           kp2 = (a^2 - b^2)/(a^2 - c^2).  Simple fractions are allowed for\n"
"           e2, k2, and kp2.  Internally, the supplied values of k2 and kp2 are\n"
"           normalized so that k2 + kp2 = 1.\n"
"\n"
"       -e2 b f\n"
"           specify a biaxial ellipsoid via its equatorial radius b and\n"
"           flattening f.  A simple fraction, is allowed for f.  In this mode,\n"
"           latitudes are interpreted as geodetic latitudes on both input and\n"
"           output.  If f is negative, bet and omg are swapped so that latitude\n"
"           and longitude have their conventional interpretations (e.g.,\n"
"           longitude measures the angle about the axis of symmetry).\n"
"\n"
"       -u  unroll the latitude and longitude.  Normally, on output latitudes\n"
"           and longitudes are reduced to lie in [-90deg,90deg] and\n"
"           [-180deg,180deg) respectively.  However with this option, the\n"
"           returned longitude bet2 and omg2 are \"unrolled\" so that bet2 - bet1\n"
"           and omg2 - omg1 indicates how often and in what sense the geodesic\n"
"           has encircled the ellipsoid.\n"
"\n"
"       -d  output angles as degrees, minutes, seconds instead of decimal\n"
"           degrees.\n"
"\n"
"       -:  like -d, except use : as a separator instead of the d, ', and \"\n"
"           delimiters.\n"
"\n"
"       -w  toggle the longitude first flag (it starts off); if the flag is on,\n"
"           then on input and output, longitude precedes latitude (except that,\n"
"           on input, this can be overridden by a hemisphere designator, N, S,\n"
"           E, W).\n"
"\n"
"       -f  full output; each line of output consists of 7 quantities: bet1\n"
"           omg1 alp1 bet2 omg2 alp2 s12.\n"
"\n"
"       -p prec\n"
"           set the output precision to prec (default 3).  For distances, prec\n"
"           is the number of digits after the decimal point for ellipsoids\n"
"           which are approximately the same size as the Earth; for other\n"
"           ellipsoids the precision is adjusted to retain the same relative\n"
"           precision.  For latitudes and longitudes (in degrees), the number\n"
"           of digits after the decimal point is prec + 5.  For cartesian\n"
"           directions, the precision is prec + 7.\n"
"\n"
"       --comment-delimiter commentdelim\n"
"           set the comment delimiter to commentdelim (e.g., \"#\" or \"//\").  If\n"
"           set, the input lines will be scanned for this delimiter and, if\n"
"           found, the delimiter and the rest of the line will be removed prior\n"
"           to processing and subsequently appended to the output line\n"
"           (separated by a space).\n"
"\n"
"       --version\n"
"           print version and exit.\n"
"\n"
"       -h  print usage and exit.\n"
"\n"
"       --help\n"
"           print full documentation and exit.\n"
"\n"
"       --input-file infile\n"
"           read input from the file infile instead of from standard input; a\n"
"           file name of \"-\" stands for standard input.\n"
"\n"
"       --input-string instring\n"
"           read input from the string instring instead of from standard input.\n"
"           All occurrences of the line separator character (default is a\n"
"           semicolon) in instring are converted to newlines before the reading\n"
"           begins.\n"
"\n"
"       --line-separator linesep\n"
"           set the line separator character to linesep.  By default this is a\n"
"           semicolon.\n"
"\n"
"       --output-file outfile\n"
"           write output to the file outfile instead of to standard output; a\n"
"           file name of \"-\" stands for standard output.\n"
"\n"
"INPUT\n"
"       Geod3Solve measures all angles in degrees and all lengths (s12) in\n"
"       meters.  On input angles (latitude, longitude, azimuth) can be as\n"
"       decimal degrees or degrees, minutes, seconds.  For example, \"40d30\",\n"
"       \"40d30'\", \"40:30\", \"40.5d\", and 40.5 are all equivalent.  By default,\n"
"       latitude precedes longitude for each point (the -w flag switches this\n"
"       convention); however on input either may be given first by appending\n"
"       (or prepending) N or S to the latitude and E or W to the longitude.\n"
"       Azimuths are measured clockwise from north; however this may be\n"
"       overridden with E or W.\n"
"\n"
"       For details on the allowed formats for angles, see the \"GEOGRAPHIC\n"
"       COORDINATES\" section of GeoConvert(1).\n"
"\n"
"ERRORS\n"
"       An illegal line of input will print an error message to standard output\n"
"       beginning with \"ERROR:\" and causes Geod3Solve to return an exit code of\n"
"       1.  However, an error does not cause Geod3Solve to terminate; following\n"
"       lines will be converted.\n"
"\n"
"EXAMPLES\n"
"       Route from JFK Airport to Singapore Changi Airport on a triaxial\n"
"       ellipsoid:\n"
"\n"
"         echo 40:38:23N 073:46:44W-19.43W X 01:21:33N 103:59:22E-19.43W |\n"
"           tr X '\\n' |\n"
"           tools/Cart3Convert -G | tools/Cart3Convert -E -r | tr '\\n' ' ' |\n"
"           tools/Geod3Solve -i -: -p 0\n"
"         => 003:15:05.9 177:27:09.0 15339505\n"
"\n"
"       The steps here are shift for longitude of major axis (-19.43d), convert\n"
"       to geocentric for biaxial Earth, convert to ellipsoidal for triaxial\n"
"       Earth, compute geodesic distance.\n"
"\n"
"SEE ALSO\n"
"       Cart3Convert(1).\n"
"\n"
"       The algorithms are described in C. F. F. Karney, Jacobi's solution for\n"
"       geodesics on a triaxial ellipsoid, Technical Report, SRI International,\n"
"       Nov. 2025, <https://arxiv.org/abs/2511.01621>.\n"
"\n"
"       The Wikipedia page, Geodesics on an ellipsoid,\n"
"       <https://en.wikipedia.org/wiki/Geodesics_on_an_ellipsoid>.\n"
"\n"
"AUTHOR\n"
"       Geod3Solve was written by Charles Karney.\n"
"\n"
"HISTORY\n"
;
  return retval;
}
